Replace the pipeline template with a marker: the config is served by the update server
This commit is contained in:
@@ -4,13 +4,11 @@ CI/CD templates for [LÖVE](https://love2d.org) (Love2D/Lua) game
|
||||
projects, in the same spirit as [tic80-tools](../tic80-tools).
|
||||
|
||||
- `example-makefile.make` — project Makefile: local dev targets
|
||||
(`build`, `love`, `web`, `export`, `binaries`, `watch`, `clean`)
|
||||
plus the Woodpecker pipeline targets (`ci-version`, `ci-export`,
|
||||
`ci-binaries`, `ci-upload`, `ci-publish`).
|
||||
- `example-woodpecker.yaml` — Woodpecker pipeline: version → export
|
||||
(`.love` package + love.js web build) → binaries (fused desktop
|
||||
builds) → upload (HTTP POST to `/build/upload`) → update (calls the
|
||||
teletypegames `/build/publish` endpoint with `platform=love`).
|
||||
(`build`, `love`, `web`, `export`, `binaries`, `watch`, `clean`).
|
||||
- `example-woodpecker.yaml` — a one-line marker (`platform: love`): the
|
||||
full pipeline (version → export → binaries → upload → publish) is served by the update server's Woodpecker
|
||||
configuration extension — preview it with
|
||||
`curl "https://teletypegames.org/build/config?platform=love"`.
|
||||
- `example-tasks.json` — VS Code `.vscode/tasks.json` with the common
|
||||
dev tasks: **Run Löve** (`love .`, default build task,
|
||||
`Cmd+Shift+B`), **Build & Run Löve**, **Build .love package** and
|
||||
@@ -20,19 +18,20 @@ projects, in the same spirit as [tic80-tools](../tic80-tools).
|
||||
|
||||
1. Copy `example-makefile.make` to `Makefile` and set `PROJECT`
|
||||
(the package is built as `dist/$(PROJECT).love`).
|
||||
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`.
|
||||
|
||||
The pipeline uploads `$(PROJECT)-$(VERSION).love.zip`,
|
||||
The served pipeline uploads `$(PROJECT)-$(VERSION).love.zip`,
|
||||
`$(PROJECT)-$(VERSION).html.zip`, the versioned `metadata.json` and
|
||||
the fused binary zips (`-win-x64.zip`, `-mac-universal.zip`,
|
||||
`-linux-x64.zip`) via `/build/upload`, then triggers `/build/publish` twice: once
|
||||
with `platform=love` (desktop package) and once with
|
||||
`platform=love-web` (web build). The API's `BinaryAttachment` concern
|
||||
picks up the `<name>-<version>-<slug>.zip` files automatically and
|
||||
registers them as `win_x64` / `mac_universal` / `linux_x64` release
|
||||
assets.
|
||||
`-linux-x64.zip`) via `/build/upload`, then triggers `/build/publish`
|
||||
with `platform=love`. The API's `BinaryAttachment` concern picks up
|
||||
the `<name>-<version>-<slug>.zip` files automatically and registers
|
||||
them as `win_x64` / `mac_universal` / `linux_x64` release assets.
|
||||
|
||||
## Native (fused) binaries
|
||||
|
||||
|
||||
+1
-45
@@ -12,8 +12,6 @@ OUTPUT_LOVE = $(DIST_DIR)/$(LOVE_NAME)
|
||||
OUTPUT_ZIP = $(PROJECT)-$(VERSION).love.zip
|
||||
OUTPUT_WEB_ZIP = $(PROJECT)-$(VERSION).html.zip
|
||||
|
||||
VERSION_FILE = .version
|
||||
|
||||
# The love-builder CI image pre-fetches love.js here; local builds fall
|
||||
# back to downloading it from GitHub.
|
||||
LOVEJS_URL = https://github.com/2dengine/love.js/archive/refs/heads/master.zip
|
||||
@@ -168,46 +166,4 @@ watch:
|
||||
clean:
|
||||
rm -rf $(BIN_DIR) $(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-binaries:
|
||||
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||
$(MAKE) binaries VERSION=$$VERSION
|
||||
|
||||
ci-upload:
|
||||
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||
FILE_LOVE="$(PROJECT)-$$VERSION.love.zip"; \
|
||||
FILE_WEB="$(PROJECT)-$$VERSION.html.zip"; \
|
||||
META_SRC="metadata.json"; \
|
||||
META_DST="$(PROJECT)-$$VERSION.metadata.json"; \
|
||||
cp $$META_SRC $$META_DST; \
|
||||
BINS=""; \
|
||||
for slug in $(BINARY_SLUGS); do \
|
||||
[ -f "$(PROJECT)-$$VERSION-$$slug.zip" ] && BINS="$$BINS $(PROJECT)-$$VERSION-$$slug.zip"; \
|
||||
done; \
|
||||
for f in $$FILE_LOVE $$FILE_WEB $$META_DST $$BINS; 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=love&version=$$VERSION"; \
|
||||
curl -fsS -X POST -H "X-Update-Secret: $(UPDATE_SECRET)" "$(UPDATE_SERVER)/build/publish?name=$(PROJECT)&platform=love-web&version=$$VERSION"
|
||||
|
||||
.PHONY: all build love web export binaries binary-win binary-mac binary-linux watch clean ci-version ci-export ci-binaries ci-upload ci-publish
|
||||
.PHONY: all build love web export binaries binary-win binary-mac binary-linux watch clean
|
||||
|
||||
+5
-38
@@ -1,38 +1,5 @@
|
||||
steps:
|
||||
- name: version
|
||||
image: alpine
|
||||
commands:
|
||||
- apk add --no-cache git make jq
|
||||
- make ci-version
|
||||
|
||||
- name: export
|
||||
image: git.teletypegames.org/internal/love-builder:latest
|
||||
pull: true
|
||||
commands:
|
||||
- make ci-export
|
||||
|
||||
- name: binaries
|
||||
image: git.teletypegames.org/internal/love-builder:latest
|
||||
pull: true
|
||||
commands:
|
||||
- make ci-binaries
|
||||
|
||||
- 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=love"
|
||||
platform: love
|
||||
# name: mygame # only when the software name differs from the repo name
|
||||
|
||||
Reference in New Issue
Block a user