Switch the CI templates to the /build HTTP endpoints
This commit is contained in:
@@ -11,8 +11,7 @@ projects, in the same spirit as
|
||||
`ci-update`).
|
||||
- `example-woodpecker.yaml` — Woodpecker pipeline: version → build
|
||||
(syntax check + web bundle in the
|
||||
`git.teletypegames.org/internal/phaser-builder` image) → upload (scp to
|
||||
the droparea) → update (calls the teletypegames `/update` endpoint
|
||||
`git.teletypegames.org/internal/phaser-builder` image) → upload (HTTP POST to `/build/upload`) → update (calls the teletypegames `/build/publish` endpoint
|
||||
with `platform=phaser`).
|
||||
- `builder.Dockerfile` — the CI builder image: `node:22-alpine` with
|
||||
make/zip/curl baked in.
|
||||
@@ -35,15 +34,15 @@ single `game.js`. Node is only used for a `node --check` syntax pass.
|
||||
concatenated in filename order — prefix with numbers if load order
|
||||
matters).
|
||||
2. Copy `example-woodpecker.yaml` to `.woodpecker.yaml` and add the
|
||||
`droparea_ssh_password` / `update_secret_key` secrets in Woodpecker.
|
||||
`update_secret_key` secret in Woodpecker.
|
||||
3. Copy `example-tasks.json` to `.vscode/tasks.json`.
|
||||
|
||||
`make serve` builds the web bundle and serves it on
|
||||
`http://localhost:8000` (Python 3's built-in HTTP server).
|
||||
|
||||
The pipeline uploads `$(PROJECT)-$(VERSION).html.zip` to the droparea,
|
||||
The pipeline uploads `$(PROJECT)-$(VERSION).html.zip` via `/build/upload`,
|
||||
then triggers
|
||||
`/update?platform=phaser&name=$(PROJECT)&version=$(VERSION)`.
|
||||
`/build/publish?platform=phaser&name=$(PROJECT)&version=$(VERSION)`.
|
||||
|
||||
## Builder image
|
||||
|
||||
|
||||
@@ -71,12 +71,14 @@ ci-upload:
|
||||
META_SRC="metadata.json"; \
|
||||
META_DST="$(PROJECT)-$$VERSION.metadata.json"; \
|
||||
cp $$META_SRC $$META_DST; \
|
||||
sshpass -p "$(DROPAREA_SSH_PASSWORD)" scp -o StrictHostKeyChecking=no -P $(DROPAREA_PORT) \
|
||||
$$FILE $$META_DST \
|
||||
$(DROPAREA_USER)@$(DROPAREA_HOST):$(DROPAREA_TARGET_PATH)/
|
||||
for f in $$FILE $$META_DST; do \
|
||||
curl -fsS -H "X-Update-Secret: $(UPDATE_SECRET)" \
|
||||
-F "file=@$$f" \
|
||||
"$(UPDATE_SERVER)/build/upload?name=$(PROJECT)&version=$$VERSION" || exit 1; \
|
||||
done
|
||||
|
||||
ci-update:
|
||||
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||
curl "$(UPDATE_SERVER)/update?secret=$(UPDATE_SECRET)&name=$(PROJECT)&platform=phaser&version=$$VERSION"
|
||||
curl -fsS -X POST -H "X-Update-Secret: $(UPDATE_SECRET)" "$(UPDATE_SERVER)/build/publish?name=$(PROJECT)&platform=phaser&version=$$VERSION"
|
||||
|
||||
.PHONY: all build web serve export watch clean ci-version ci-export ci-upload ci-update
|
||||
|
||||
@@ -13,14 +13,11 @@ steps:
|
||||
- name: upload
|
||||
image: alpine
|
||||
environment:
|
||||
DROPAREA_HOST: vps.teletype.hu
|
||||
DROPAREA_PORT: 2223
|
||||
DROPAREA_TARGET_PATH: /home/drop
|
||||
DROPAREA_USER: drop
|
||||
DROPAREA_SSH_PASSWORD:
|
||||
from_secret: droparea_ssh_password
|
||||
UPDATE_SERVER: https://teletypegames.org
|
||||
UPDATE_SECRET:
|
||||
from_secret: update_secret_key
|
||||
commands:
|
||||
- apk add --no-cache make openssh-client sshpass
|
||||
- apk add --no-cache make curl
|
||||
- make ci-upload
|
||||
|
||||
- name: update
|
||||
|
||||
Reference in New Issue
Block a user