diff --git a/README.md b/README.md index 45f2de7..0f4e464 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,11 @@ projects, in the same spirit as [love-tools](../love-tools). - `example-makefile.make` — project Makefile: local dev targets - (`build`, `web`, `serve`, `export`, `watch`, `clean`) plus the - Woodpecker pipeline targets (`ci-version`, `ci-export`, `ci-upload`, - `ci-publish`). -- `example-woodpecker.yaml` — Woodpecker pipeline: version → build - (syntax check + web bundle in the - `git.teletypegames.org/internal/phaser-builder` image) → upload (HTTP POST to `/build/upload`) → publish (calls the teletypegames `/build/publish` endpoint - with `platform=phaser`). + (`build`, `web`, `serve`, `export`, `watch`, `clean`). +- `example-woodpecker.yaml` — a one-line marker (`platform: phaser`): the + full pipeline (version → build → upload → publish) is served by the update server's Woodpecker + configuration extension — preview it with + `curl "https://teletypegames.org/build/config?platform=phaser"`. - `builder.Dockerfile` — the CI builder image: `node:22-alpine` with make/zip/curl baked in. - `example-tasks.json` — VS Code `.vscode/tasks.json` with the common @@ -33,14 +31,17 @@ single `game.js`. Node is only used for a `node --check` syntax pass. `PHASER_VERSION`, and put the game sources into `src/` (they are concatenated in filename order — prefix with numbers if load order matters). -2. Copy `example-woodpecker.yaml` to `.woodpecker.yaml` and add the - `update_secret_key` secret in Woodpecker. +2. Copy `example-woodpecker.yaml` to `.woodpecker.yaml` (a one-line marker — the + pipeline itself is served by the update server; add `name:` when the + software name differs from the repo name) and add the + `application_token` secret in Woodpecker (an ApplicationToken with + the `update` + `upload` scopes, created in the admin). 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` via `/build/upload`, +The served pipeline uploads `$(PROJECT)-$(VERSION).html.zip` via `/build/upload`, then triggers `/build/publish?platform=phaser&name=$(PROJECT)&version=$(VERSION)`. diff --git a/example-makefile.make b/example-makefile.make index 81bf388..9c37543 100644 --- a/example-makefile.make +++ b/example-makefile.make @@ -11,7 +11,6 @@ DIST_DIR = dist WEB_DIR = $(DIST_DIR)/web OUTPUT_ZIP = $(PROJECT)-$(VERSION).html.zip -VERSION_FILE = .version PHASER_JS_URL = https://cdn.jsdelivr.net/npm/phaser@$(PHASER_VERSION)/dist/phaser.min.js INDEX_HTML_URL = https://git.teletypegames.org/tools/phaser-tools/raw/branch/master/web/index.html @@ -49,36 +48,4 @@ watch: clean: rm -rf $(DIST_DIR) -ci-version: - @if [ -f metadata.json ]; then \ - VERSION=$$(jq -r '.version' metadata.json); \ - else \ - VERSION=$$(git rev-parse --short HEAD); \ - fi; \ - BRANCH=$$(git rev-parse --abbrev-ref HEAD); \ - if [ "$$BRANCH" != "main" ] && [ "$$BRANCH" != "master" ]; then \ - VERSION="dev-$$VERSION-$$BRANCH"; \ - fi; \ - echo $$VERSION > $(VERSION_FILE) - -ci-export: - @VERSION=$$(cat $(VERSION_FILE)); \ - $(MAKE) export VERSION=$$VERSION - -ci-upload: - @VERSION=$$(cat $(VERSION_FILE)); \ - FILE="$(PROJECT)-$$VERSION.html.zip"; \ - META_SRC="metadata.json"; \ - META_DST="$(PROJECT)-$$VERSION.metadata.json"; \ - cp $$META_SRC $$META_DST; \ - 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-publish: - @VERSION=$$(cat $(VERSION_FILE)); \ - 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-publish +.PHONY: all build web serve export watch clean diff --git a/example-woodpecker.yaml b/example-woodpecker.yaml index e7accac..9404a08 100644 --- a/example-woodpecker.yaml +++ b/example-woodpecker.yaml @@ -1,31 +1,5 @@ -steps: - - name: version - image: alpine - commands: - - apk add --no-cache git make jq - - make ci-version - - - name: build - image: git.teletypegames.org/internal/phaser-builder:latest - commands: - - make ci-export - - - name: upload - image: alpine - environment: - UPDATE_SERVER: https://teletypegames.org - UPDATE_SECRET: - from_secret: update_secret_key - commands: - - apk add --no-cache make curl - - make ci-upload - - - name: publish - image: alpine - environment: - UPDATE_SERVER: https://teletypegames.org - UPDATE_SECRET: - from_secret: update_secret_key - commands: - - apk add --no-cache make curl - - make ci-publish +# One-line marker: the full pipeline is served by the update server's +# Woodpecker configuration extension. Preview it with: +# curl "https://teletypegames.org/build/config?platform=phaser" +platform: phaser +# name: mygame # only when the software name differs from the repo name