Merge branch 'feature/deploy-ci'
@@ -60,3 +60,7 @@ node --test test/*.test.js
60
60
- `src/` – game, `levelFormat.js`, `floorCast.js`, `editorApp.js`, `src/ppda/`
61
61
- `build/` – speelbare output + `levels.json` + `editor.html`
62
62
- `archive/legacy-js/` – oude canvas2d-versie
63
64
## Deploy
65
66
BlueGit CI (`ftp_upload` op master) synchroniseert `build/` via FTP naar `projectftp` (secrets: `timftphost`/`timftpuser`/`timftppassword`/`timftproot`/`projectftp`). **Geen `--delete`**. Live: https://projects.timfalken.com/raytracer/
@@ -60,3 +60,7 @@ node --test test/*.test.js60
- `src/` – game, `levelFormat.js`, `floorCast.js`, `editorApp.js`, `src/ppda/`60
- `src/` – game, `levelFormat.js`, `floorCast.js`, `editorApp.js`, `src/ppda/`61
- `build/` – speelbare output + `levels.json` + `editor.html`61
- `build/` – speelbare output + `levels.json` + `editor.html`62
- `archive/legacy-js/` – oude canvas2d-versie62
- `archive/legacy-js/` – oude canvas2d-versie63
64
## Deploy65
66
BlueGit CI (`ftp_upload` op master) synchroniseert `build/` via FTP naar `projectftp` (secrets: `timftphost`/`timftpuser`/`timftppassword`/`timftproot`/`projectftp`). **Geen `--delete`**. Live: https://projects.timfalken.com/raytracer/@@ -1,5 +1,9 @@
1
# BlueGit CI for raytracer: build game.js + editor.js bundle + node tests.
2
stages: [test, build]
1
# BlueGit CI for raytracer: tests, build game/editor bundle, FTP deploy of build/.
2
# Secrets (repo): timftphost, timftpuser, timftppassword, timftproot (protected),
3
# projectftp (expand; typically ${timftproot}raytracer).
4
# GEEN mirror --delete (tuinslang-incident): live files mogen niet verdwijnen.
5
# Deployt map build/ (NIET web/, NIET repo-root).
6
stages: [test, build, deploy]
3
7
4
8
workflow:
5
9
rules:
@@ -29,6 +33,8 @@ build_game:
29
33
- test -f build/index.html
30
34
- test -f build/editor.html
31
35
- test -f build/levels.json
36
- test -d build/images
37
- test -d build/paperdolls
32
38
artifacts:
33
39
paths:
34
40
- build/game.js
@@ -38,3 +44,49 @@ build_game:
38
44
- build/framework.js
39
45
- build/levels.json
40
46
expire_in: 7d
47
48
ftp_upload:
49
stage: deploy
50
image: debian:bookworm-slim
51
needs: [build_game]
52
resource_group: production
53
rules:
54
# Alleen master push (protected secrets). Geen feature/MR-deploys.
55
- if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event"
56
script:
57
- apt-get update -qy
58
- apt-get install -y --no-install-recommends lftp python3 ca-certificates
59
# BlueGit expandeert $timftproot in secrets niet altijd; doe het zelf.
60
- export projectftp="$(python3 -c 'import os;r=os.environ.get("timftproot","");print(os.environ["projectftp"].replace("${timftproot}",r).replace("$timftproot",r))')"
61
- test -n "$projectftp"
62
- |
63
python3 - <<'PY'
64
import os, sys
65
p = os.environ["projectftp"].rstrip("/")
66
root = os.environ.get("timftproot", "").rstrip("/")
67
if not p or p == root or p == "/" or p == ".":
68
print("REFUSING: projectftp is FTP-root or empty:", repr(p))
69
sys.exit(3)
70
# Pad moet op dit project eindigen (voorkomt verkeerde secret).
71
leaf = p.rsplit("/", 1)[-1]
72
if leaf != "raytracer" and not p.endswith("/raytracer"):
73
print("REFUSING: projectftp does not end with raytracer:", p)
74
sys.exit(3)
75
print("deploy target ok (path redacted length=%d leaf=%s)" % (len(p), leaf))
76
PY
77
- test -f build/index.html
78
- test -f build/editor.html
79
- test -f build/game.js
80
- test -d build/images
81
# Upload alleen build/. GEEN --delete. Excludes: CI/shot-helpers/bron.
82
- |
83
printf '%s\n' \
84
'set ssl:verify-certificate no' \
85
'set sftp:auto-confirm yes' \
86
'set xfer:use-temp-file yes' \
87
'set cmd:fail-exit yes' \
88
"mkdir -p -f $projectftp" \
89
"cd $projectftp" \
90
'mirror -R --exclude-glob .git/** --exclude-glob shot-*.html --exclude-glob shot-*.js --exclude-glob shot-*.png --exclude-glob blue-ci-cd.yml --exclude-glob README.md --exclude-glob .gitignore build/ .' \
91
'bye' \
92
| lftp -u "$timftpuser","$timftppassword" "$timftphost"
@@ -1,5 +1,9 @@1
# BlueGit CI for raytracer: build game.js + editor.js bundle + node tests.1
# BlueGit CI for raytracer: tests, build game/editor bundle, FTP deploy of build/.2
stages: [test, build]2
# Secrets (repo): timftphost, timftpuser, timftppassword, timftproot (protected),3
# projectftp (expand; typically ${timftproot}raytracer).4
# GEEN mirror --delete (tuinslang-incident): live files mogen niet verdwijnen.5
# Deployt map build/ (NIET web/, NIET repo-root).6
stages: [test, build, deploy]3
7
4
workflow:8
workflow:5
rules:9
rules:@@ -29,6 +33,8 @@ build_game:29
- test -f build/index.html33
- test -f build/index.html30
- test -f build/editor.html34
- test -f build/editor.html31
- test -f build/levels.json35
- test -f build/levels.json36
- test -d build/images37
- test -d build/paperdolls32
artifacts:38
artifacts:33
paths:39
paths:34
- build/game.js40
- build/game.js@@ -38,3 +44,49 @@ build_game:38
- build/framework.js44
- build/framework.js39
- build/levels.json45
- build/levels.json40
expire_in: 7d46
expire_in: 7d47
48
ftp_upload:49
stage: deploy50
image: debian:bookworm-slim51
needs: [build_game]52
resource_group: production53
rules:54
# Alleen master push (protected secrets). Geen feature/MR-deploys.55
- if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE != "merge_request_event"56
script:57
- apt-get update -qy58
- apt-get install -y --no-install-recommends lftp python3 ca-certificates59
# BlueGit expandeert $timftproot in secrets niet altijd; doe het zelf.60
- export projectftp="$(python3 -c 'import os;r=os.environ.get("timftproot","");print(os.environ["projectftp"].replace("${timftproot}",r).replace("$timftproot",r))')"61
- test -n "$projectftp"62
- |63
python3 - <<'PY'64
import os, sys65
p = os.environ["projectftp"].rstrip("/")66
root = os.environ.get("timftproot", "").rstrip("/")67
if not p or p == root or p == "/" or p == ".":68
print("REFUSING: projectftp is FTP-root or empty:", repr(p))69
sys.exit(3)70
# Pad moet op dit project eindigen (voorkomt verkeerde secret).71
leaf = p.rsplit("/", 1)[-1]72
if leaf != "raytracer" and not p.endswith("/raytracer"):73
print("REFUSING: projectftp does not end with raytracer:", p)74
sys.exit(3)75
print("deploy target ok (path redacted length=%d leaf=%s)" % (len(p), leaf))76
PY77
- test -f build/index.html78
- test -f build/editor.html79
- test -f build/game.js80
- test -d build/images81
# Upload alleen build/. GEEN --delete. Excludes: CI/shot-helpers/bron.82
- |83
printf '%s\n' \84
'set ssl:verify-certificate no' \85
'set sftp:auto-confirm yes' \86
'set xfer:use-temp-file yes' \87
'set cmd:fail-exit yes' \88
"mkdir -p -f $projectftp" \89
"cd $projectftp" \90
'mirror -R --exclude-glob .git/** --exclude-glob shot-*.html --exclude-glob shot-*.js --exclude-glob shot-*.png --exclude-glob blue-ci-cd.yml --exclude-glob README.md --exclude-glob .gitignore build/ .' \91
'bye' \92
| lftp -u "$timftpuser","$timftppassword" "$timftphost"