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