Replace the pipeline template with a marker: the config is served by the update server
This commit is contained in:
@@ -4,14 +4,12 @@ CI/CD templates for [TIC-80](https://tic80.com) (Lua) game projects.
|
||||
|
||||
- `example-makefile.make` — project Makefile: local dev targets
|
||||
(`build`, `minify`, `binaries`, `watch`, `lint`, `docs`,
|
||||
`import_assets`, `export_assets`, `clean`, `install_precommit_hook`)
|
||||
plus the Woodpecker pipeline targets (`ci-version`, `ci-lint`,
|
||||
`ci-minify`, `ci-docs`, `ci-export`, `ci-binaries`, `ci-artifact`,
|
||||
`ci-publish`).
|
||||
- `example-woodpecker.yaml` — Woodpecker pipeline: version → lint →
|
||||
minify → docs → export (TIC-80 Pro image) → binaries (native
|
||||
players, same image) → artifact (HTTP POST to `/build/upload`) → update
|
||||
(calls the teletypegames `/build/publish` endpoint with `platform=tic80`).
|
||||
`import_assets`, `export_assets`, `clean`, `install_precommit_hook`).
|
||||
- `example-woodpecker.yaml` — a one-line marker (`platform: tic80`): the
|
||||
full pipeline (version → lint → minify → docs → export → binaries →
|
||||
artifact → publish) is served by the update server's Woodpecker
|
||||
configuration extension — preview it with
|
||||
`curl "https://teletypegames.org/build/config?platform=tic80"`.
|
||||
- `example-tasks.json` — VS Code `.vscode/tasks.json` with the common
|
||||
dev tasks: **Run TIC80** (default build task, `Cmd+Shift+B`),
|
||||
**Build & Run TIC80**, **Export assets** and **Make build**.
|
||||
@@ -21,12 +19,15 @@ CI/CD templates for [TIC-80](https://tic80.com) (Lua) game projects.
|
||||
1. Copy `example-makefile.make` to `Makefile` and set `PROJECT`
|
||||
(the cartridge is built as `$(PROJECT).lua` from the file list in
|
||||
`$(PROJECT).inc`).
|
||||
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` and replace the
|
||||
cart name (`impostor.lua`) with `$(PROJECT).lua`.
|
||||
|
||||
The pipeline uploads `$(PROJECT)-$(VERSION).lua`, `.tic`, `.html.zip`,
|
||||
The served pipeline uploads `$(PROJECT)-$(VERSION).lua`, `.tic`, `.html.zip`,
|
||||
`-docs.zip` and the native player zips (`-win-x64.zip`,
|
||||
`-linux-x64.zip`, `-mac-x64.zip`) via `/build/upload`, then triggers
|
||||
`/build/publish?platform=tic80&name=$(PROJECT)&version=$(VERSION)`. The API's
|
||||
|
||||
+1
-68
@@ -24,9 +24,6 @@ LINT_TMP_LUA := /tmp/_lint_combined.lua
|
||||
LINT_TMP_MAP := /tmp/_lint_map.txt
|
||||
|
||||
# CI/CD variables
|
||||
VERSION_FILE = .version
|
||||
GAME_LANG ?= lua
|
||||
UPDATE_SERVER ?= https://teletypegames.org
|
||||
|
||||
all: build
|
||||
|
||||
@@ -230,68 +227,4 @@ docs: build
|
||||
@ldoc ${OUTPUT} -d docs
|
||||
@echo "==> Documentation generated."
|
||||
|
||||
# -----------------------------------------
|
||||
# CI/CD Pipeline targets
|
||||
# -----------------------------------------
|
||||
|
||||
ci-version:
|
||||
@VERSION=$$(sed -n "s/^-- version: //p" inc/meta/meta.header.lua | head -n 1 | tr -d "[:space:]"); \
|
||||
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-lint: lint
|
||||
|
||||
ci-minify: minify
|
||||
|
||||
ci-docs:
|
||||
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||
echo "==> Generating docs from $(OUTPUT_ORIGINAL)"; \
|
||||
ldoc $(OUTPUT_ORIGINAL) -d docs; \
|
||||
echo "==> Zipping docs for version $$VERSION"; \
|
||||
(cd docs && zip -r ../$(PROJECT)-$$VERSION-docs.zip .); \
|
||||
cp $(PROJECT)-$$VERSION-docs.zip $(PROJECT)-docs.zip; \
|
||||
echo "==> Docs zip created"
|
||||
|
||||
ci-export:
|
||||
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||
echo "==> Exporting HTML for version $$VERSION"; \
|
||||
tic80 --cli --skip --fs=. \
|
||||
--cmd="load $(OUTPUT) & save $(PROJECT)-$$VERSION & export html $(PROJECT)-$$VERSION.html & exit"; \
|
||||
if [ -f "$(PROJECT)-$$VERSION.tic" ]; then \
|
||||
cp $(PROJECT)-$$VERSION.tic $(PROJECT).tic; \
|
||||
fi; \
|
||||
if [ -f "$(PROJECT)-$$VERSION.html.zip" ]; then \
|
||||
cp $(PROJECT)-$$VERSION.html.zip $(PROJECT).html.zip; \
|
||||
fi; \
|
||||
echo "==> Generated files:"; \
|
||||
ls -lh $(PROJECT)-$$VERSION.* $(PROJECT).tic $(PROJECT).html.zip 2>/dev/null || true
|
||||
|
||||
ci-binaries:
|
||||
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||
$(MAKE) binaries VERSION=$$VERSION
|
||||
|
||||
ci-artifact:
|
||||
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||
echo "==> Uploading artifacts for version $$VERSION"; \
|
||||
cp $(PROJECT).lua $(PROJECT)-$$VERSION.lua; \
|
||||
BINS=""; \
|
||||
for slug in $(BINARY_SLUGS); do \
|
||||
[ -f "$(PROJECT)-$$VERSION-$$slug.zip" ] && BINS="$$BINS $(PROJECT)-$$VERSION-$$slug.zip"; \
|
||||
done; \
|
||||
for f in $(PROJECT)-$$VERSION.lua $(PROJECT)-$$VERSION.tic $(PROJECT)-$$VERSION.html.zip $(PROJECT)-$$VERSION-docs.zip $$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)); \
|
||||
echo "==> Publishing version $$VERSION"; \
|
||||
curl -fsS -X POST -H "X-Update-Secret: $(UPDATE_SECRET)" "$(UPDATE_SERVER)/build/publish?name=$(PROJECT)&platform=tic80&version=$$VERSION"
|
||||
|
||||
.PHONY: all build download-minify minify export binaries watch import_assets export_assets clean lint install_precommit_hook docs ci-version ci-lint ci-minify ci-docs ci-export ci-binaries ci-artifact ci-publish
|
||||
.PHONY: all build download-minify minify export binaries watch import_assets export_assets clean lint install_precommit_hook docs
|
||||
|
||||
+5
-65
@@ -1,65 +1,5 @@
|
||||
steps:
|
||||
- name: version
|
||||
image: alpine
|
||||
commands:
|
||||
- 'apk add --no-cache make'
|
||||
- 'make ci-version'
|
||||
|
||||
- name: lint
|
||||
image: alpine
|
||||
commands:
|
||||
- 'apk add --no-cache make lua5.4 lua5.4-dev luarocks gcc musl-dev'
|
||||
- 'ln -sf /usr/bin/lua5.4 /usr/bin/lua'
|
||||
- 'ln -sf /usr/bin/luarocks-5.4 /usr/bin/luarocks'
|
||||
- 'luarocks install luacheck'
|
||||
- 'make ci-lint'
|
||||
|
||||
- name: minify
|
||||
image: alpine
|
||||
commands:
|
||||
- 'apk add --no-cache make lua5.4 curl'
|
||||
- 'ln -sf /usr/bin/lua5.4 /usr/bin/lua'
|
||||
- 'make ci-minify'
|
||||
|
||||
- name: docs
|
||||
image: alpine
|
||||
commands:
|
||||
- 'apk add --no-cache make lua5.4 lua5.4-dev luarocks gcc musl-dev zip'
|
||||
- 'ln -sf /usr/bin/lua5.4 /usr/bin/lua'
|
||||
- 'ln -sf /usr/bin/luarocks-5.4 /usr/bin/luarocks'
|
||||
- 'luarocks install ldoc'
|
||||
- 'make ci-docs'
|
||||
|
||||
- name: export
|
||||
image: git.teletypegames.org/internal/tic80pro:latest
|
||||
environment:
|
||||
XDG_RUNTIME_DIR: /tmp
|
||||
commands:
|
||||
- 'make ci-export'
|
||||
|
||||
- name: binaries
|
||||
image: git.teletypegames.org/internal/tic80pro:latest
|
||||
environment:
|
||||
XDG_RUNTIME_DIR: /tmp
|
||||
commands:
|
||||
- 'make ci-binaries'
|
||||
|
||||
- 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=tic80"
|
||||
platform: tic80
|
||||
# name: mygame # only when the software name differs from the repo name
|
||||
|
||||
Reference in New Issue
Block a user