diff --git a/README.md b/README.md index e892159..b85d8be 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,11 @@ CI/CD templates for Commodore 64 (ACME + VICE) game projects, in the same spirit as [tic80-tools](../tic80-tools). - `example-makefile.make` — project Makefile: local dev targets - (`deps`, `build`, `run`, `clear`, `rebuild`, `rebuildrun`) plus the - Woodpecker pipeline targets (`ci-version`, `ci-build`, `ci-artifact`, - `ci-publish`). -- `example-woodpecker.yaml` — Woodpecker pipeline: version → build - (Debian, `apt install acme`) → artifact (HTTP POST to `/build/upload`) → - publish (calls the teletypegames `/build/publish` endpoint with - `platform=c64`). + (`deps`, `build`, `run`, `clear`, `rebuild`, `rebuildrun`). +- `example-woodpecker.yaml` — a one-line marker (`platform: c64`): the + full pipeline (version → build → artifact → publish) is served by the update server's Woodpecker + configuration extension — preview it with + `curl "https://teletypegames.org/build/config?platform=c64"`. - `example-metadata.json` — catalog metadata; the `version` field drives `ci-version`, the rest (`name`, `title`, `author`, `desc`, `site`, `repo`, `license`) is what `SoftwareUpdater::C64Service` writes into @@ -25,8 +23,11 @@ spirit as [tic80-tools](../tic80-tools). `TARGET` if the .prg name differs from `$(PROJECT).prg`). 2. Copy `example-metadata.json` to `metadata.json` and fill it in; `name` must match `PROJECT`. -3. Copy `example-woodpecker.yaml` to `.woodpecker.yaml` and add the - `update_secret_key` secret in Woodpecker. +3. 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). 4. Copy `example-tasks.json` to `.vscode/tasks.json`. ## Builder image @@ -42,7 +43,7 @@ docker build --platform linux/amd64 -f builder.Dockerfile \ docker push git.teletypegames.org/internal/c64-builder:latest ``` -The pipeline uploads `$(PROJECT)-$(VERSION).prg` and +The served pipeline uploads `$(PROJECT)-$(VERSION).prg` and `$(PROJECT)-$(VERSION).metadata.json` via `/build/upload`, then triggers `/build/publish?platform=c64&name=$(PROJECT)&version=$(VERSION)`, which creates/updates the Software row and a Release with `cartridge_path`. diff --git a/example-makefile.make b/example-makefile.make index 957c83b..25e3bc3 100644 --- a/example-makefile.make +++ b/example-makefile.make @@ -16,7 +16,6 @@ UNAME_S := $(shell uname -s) # CI/CD variables VERSION_FILE = .version -UPDATE_SERVER ?= https://teletypegames.org all: build @@ -45,43 +44,4 @@ rebuild: clear build rebuildrun: clear build run -# ----------------------------------------- -# CI/CD Pipeline targets -# ----------------------------------------- - -ci-version: - @VERSION=$$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' $(METADATA) | head -n 1); \ - if [ -z "$$VERSION" ]; then \ - echo "ERROR: no \"version\" field in $(METADATA)!"; \ - exit 1; \ - fi; \ - BRANCH=$${CI_COMMIT_BRANCH:-$${WOODPECKER_BRANCH}}; \ - BRANCH=$$(echo "$$BRANCH" | tr '/' '-'); \ - if [ "$$BRANCH" != "main" ] && [ "$$BRANCH" != "master" ] && [ -n "$$BRANCH" ]; then \ - VERSION=dev-$$VERSION-$$BRANCH; \ - fi; \ - echo "VERSION is: $$VERSION"; \ - echo $$VERSION > $(VERSION_FILE) - -ci-build: build - @VERSION=$$(cat $(VERSION_FILE)); \ - echo "==> Creating versioned files for $$VERSION"; \ - cp $(TARGET) $(PROJECT)-$$VERSION.prg; \ - cp $(METADATA) $(PROJECT)-$$VERSION.metadata.json; \ - ls -lh $(PROJECT)-$$VERSION.* - -ci-artifact: - @VERSION=$$(cat $(VERSION_FILE)); \ - echo "==> Uploading artifacts for version $$VERSION"; \ - for f in $(PROJECT)-$$VERSION.prg $(PROJECT)-$$VERSION.metadata.json; 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)); \ - echo "==> Publishing version $$VERSION"; \ - curl -fsS -X POST -H "X-Update-Secret: $(UPDATE_SECRET)" "$(UPDATE_SERVER)/build/publish?name=$(PROJECT)&platform=c64&version=$$VERSION" - -.PHONY: all deps build run clear rebuild rebuildrun ci-version ci-build ci-artifact ci-publish +.PHONY: all deps build run clear rebuild rebuildrun diff --git a/example-woodpecker.yaml b/example-woodpecker.yaml index 9239669..20e52aa 100644 --- a/example-woodpecker.yaml +++ b/example-woodpecker.yaml @@ -1,31 +1,5 @@ -steps: - - name: version - image: alpine - commands: - - 'apk add --no-cache make' - - 'make ci-version' - - - name: build - image: git.teletypegames.org/internal/c64-builder:latest - commands: - - 'make ci-build' - - - name: artifact - image: alpine - environment: - UPDATE_SERVER: https://teletypegames.org - UPDATE_SECRET: - from_secret: update_secret_key - commands: - - 'apk add --no-cache make curl' - - 'make ci-artifact' - - - 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=c64" +platform: c64 +# name: mygame # only when the software name differs from the repo name