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