Switch the CI templates to the /build HTTP endpoints
This commit is contained in:
@@ -10,8 +10,8 @@ projects, in the same spirit as [tic80-tools](../tic80-tools).
|
|||||||
`ci-binaries`, `ci-upload`, `ci-update`).
|
`ci-binaries`, `ci-upload`, `ci-update`).
|
||||||
- `example-woodpecker.yaml` — Woodpecker pipeline: version → export
|
- `example-woodpecker.yaml` — Woodpecker pipeline: version → export
|
||||||
(Go, `GOOS=js GOARCH=wasm`) → binaries (native desktop zips) →
|
(Go, `GOOS=js GOARCH=wasm`) → binaries (native desktop zips) →
|
||||||
upload (scp to the droparea) → update (calls the teletypegames
|
upload (HTTP POST to `/build/upload`) → update (calls the teletypegames
|
||||||
`/update` endpoint with `platform=ebitengine`).
|
`/build/publish` endpoint with `platform=ebitengine`).
|
||||||
- `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** (`go run .`, default build task, `Cmd+Shift+B`),
|
dev tasks: **Run** (`go run .`, default build task, `Cmd+Shift+B`),
|
||||||
**Build & Run**, **Build WASM** and **Make build**.
|
**Build & Run**, **Build WASM** and **Make build**.
|
||||||
@@ -23,14 +23,14 @@ 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 native binary is built to `bin/$(PROJECT)`).
|
(the native binary is built to `bin/$(PROJECT)`).
|
||||||
2. Copy `example-woodpecker.yaml` to `.woodpecker.yaml` and add the
|
2. Copy `example-woodpecker.yaml` to `.woodpecker.yaml` and add the
|
||||||
`droparea_ssh_password` / `update_secret_key` secrets in Woodpecker.
|
`update_secret_key` secret in Woodpecker.
|
||||||
3. Copy `example-tasks.json` to `.vscode/tasks.json` and replace the
|
3. Copy `example-tasks.json` to `.vscode/tasks.json` and replace the
|
||||||
binary name (`ebitenginedemo`) with `$(PROJECT)`.
|
binary name (`ebitenginedemo`) with `$(PROJECT)`.
|
||||||
|
|
||||||
The pipeline uploads `$(PROJECT)-$(VERSION).html.zip` plus the native
|
The pipeline uploads `$(PROJECT)-$(VERSION).html.zip` plus the native
|
||||||
binary zips (`$(PROJECT)-$(VERSION)-<target>.zip`, currently `win-x86`,
|
binary zips (`$(PROJECT)-$(VERSION)-<target>.zip`, currently `win-x86`,
|
||||||
`win-x64`, `linux-x64`) to the droparea, then triggers
|
`win-x64`, `linux-x64`) via `/build/upload`, then triggers
|
||||||
`/update?platform=ebitengine&name=$(PROJECT)&version=$(VERSION)`.
|
`/build/publish?platform=ebitengine&name=$(PROJECT)&version=$(VERSION)`.
|
||||||
The updater picks up the binary zips by naming convention and attaches
|
The updater picks up the binary zips by naming convention and attaches
|
||||||
them to the release as assets (see `teletypegames/NOTES_BINARY_PLAN.md`).
|
them to the release as assets (see `teletypegames/NOTES_BINARY_PLAN.md`).
|
||||||
|
|
||||||
@@ -47,12 +47,11 @@ They are built **on a mac host** instead, packaged as a minimal
|
|||||||
`.app` bundle (generated Info.plist, ad-hoc `codesign`):
|
`.app` bundle (generated Info.plist, ad-hoc `codesign`):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make mac-release VERSION=x.y.z \
|
make mac-release VERSION=x.y.z UPDATE_SECRET=...
|
||||||
DROPAREA_SSH_PASSWORD=... UPDATE_SECRET=...
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This builds both mac zips, uploads them to the droparea and re-triggers
|
This builds both mac zips, uploads them via `/build/upload` and re-triggers
|
||||||
`/update` — the updater attaches the new assets to the already existing
|
`/build/publish` — the updater attaches the new assets to the already existing
|
||||||
release, so run it after the CI pipeline has created the release.
|
release, so run it after the CI pipeline has created the release.
|
||||||
Ad-hoc signature means Gatekeeper shows the "unidentified developer"
|
Ad-hoc signature means Gatekeeper shows the "unidentified developer"
|
||||||
warning (right-click → Open); proper signing/notarization needs an
|
warning (right-click → Open); proper signing/notarization needs an
|
||||||
|
|||||||
+14
-14
@@ -16,10 +16,6 @@ VERSION_FILE = .version
|
|||||||
INDEX_HTML_URL = https://git.teletypegames.org/tools/ebitengine-tools/raw/branch/master/web/index.html
|
INDEX_HTML_URL = https://git.teletypegames.org/tools/ebitengine-tools/raw/branch/master/web/index.html
|
||||||
|
|
||||||
# a mac-release lokális futtatásához (CI-ban a woodpecker env adja ugyanezeket)
|
# a mac-release lokális futtatásához (CI-ban a woodpecker env adja ugyanezeket)
|
||||||
DROPAREA_HOST ?= vps.teletype.hu
|
|
||||||
DROPAREA_PORT ?= 2223
|
|
||||||
DROPAREA_USER ?= drop
|
|
||||||
DROPAREA_TARGET_PATH ?= /home/drop
|
|
||||||
UPDATE_SERVER ?= https://teletypegames.org
|
UPDATE_SERVER ?= https://teletypegames.org
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
@@ -88,15 +84,17 @@ binary-mac-x64:
|
|||||||
binary-mac-arm64:
|
binary-mac-arm64:
|
||||||
@$(MAKE) binary-build-mac VERSION=$(VERSION) B_GOARCH=arm64 B_TARGET=mac-arm64
|
@$(MAKE) binary-build-mac VERSION=$(VERSION) B_GOARCH=arm64 B_TARGET=mac-arm64
|
||||||
|
|
||||||
# macről futtatandó: felépíti mindkét mac zipet, feltölti a dropareába, majd
|
# macről futtatandó: felépíti mindkét mac zipet, feltölti a /build/upload-dal,
|
||||||
# meghívja az /update-et, ami a meglévő release-hez hozzáfűzi az asseteket
|
# majd a /build/publish hozzáfűzi az asseteket a meglévő release-hez
|
||||||
mac-release: binaries-mac
|
mac-release: binaries-mac
|
||||||
@FILES=""; \
|
@FILES=""; \
|
||||||
for target in $(MAC_TARGETS); do FILES="$$FILES $(PROJECT)-$(VERSION)-$$target.zip"; done; \
|
for target in $(MAC_TARGETS); do FILES="$$FILES $(PROJECT)-$(VERSION)-$$target.zip"; done; \
|
||||||
sshpass -p "$(DROPAREA_SSH_PASSWORD)" scp -o StrictHostKeyChecking=no -P $(DROPAREA_PORT) \
|
for f in $$FILES; do \
|
||||||
$$FILES \
|
curl -fsS -H "X-Update-Secret: $(UPDATE_SECRET)" \
|
||||||
$(DROPAREA_USER)@$(DROPAREA_HOST):$(DROPAREA_TARGET_PATH)/; \
|
-F "file=@$$f" \
|
||||||
curl "$(UPDATE_SERVER)/update?secret=$(UPDATE_SECRET)&name=$(PROJECT)&platform=ebitengine&version=$(VERSION)"
|
"$(UPDATE_SERVER)/build/upload?name=$(PROJECT)&version=$(VERSION)" || exit 1; \
|
||||||
|
done; \
|
||||||
|
curl -fsS -X POST -H "X-Update-Secret: $(UPDATE_SECRET)" "$(UPDATE_SERVER)/build/publish?name=$(PROJECT)&platform=ebitengine&version=$(VERSION)"
|
||||||
|
|
||||||
# belső helper: egy target buildje + zip egyetlen gyökérmappával
|
# belső helper: egy target buildje + zip egyetlen gyökérmappával
|
||||||
# (a zipet unixos zip készíti, így a végrehajtási bit megmarad)
|
# (a zipet unixos zip készíti, így a végrehajtási bit megmarad)
|
||||||
@@ -178,12 +176,14 @@ ci-upload:
|
|||||||
META_DST="$(PROJECT)-$$VERSION.metadata.json"; \
|
META_DST="$(PROJECT)-$$VERSION.metadata.json"; \
|
||||||
BINS=$$(ls $(PROJECT)-$$VERSION-*.zip 2>/dev/null || true); \
|
BINS=$$(ls $(PROJECT)-$$VERSION-*.zip 2>/dev/null || true); \
|
||||||
cp $$META_SRC $$META_DST; \
|
cp $$META_SRC $$META_DST; \
|
||||||
sshpass -p "$(DROPAREA_SSH_PASSWORD)" scp -o StrictHostKeyChecking=no -P $(DROPAREA_PORT) \
|
for f in $$FILE $$META_DST $$BINS; do \
|
||||||
$$FILE $$META_DST $$BINS \
|
curl -fsS -H "X-Update-Secret: $(UPDATE_SECRET)" \
|
||||||
$(DROPAREA_USER)@$(DROPAREA_HOST):$(DROPAREA_TARGET_PATH)/
|
-F "file=@$$f" \
|
||||||
|
"$(UPDATE_SERVER)/build/upload?name=$(PROJECT)&version=$$VERSION" || exit 1; \
|
||||||
|
done
|
||||||
|
|
||||||
ci-update:
|
ci-update:
|
||||||
@VERSION=$$(cat $(VERSION_FILE)); \
|
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||||
curl "$(UPDATE_SERVER)/update?secret=$(UPDATE_SECRET)&name=$(PROJECT)&platform=ebitengine&version=$$VERSION"
|
curl -fsS -X POST -H "X-Update-Secret: $(UPDATE_SECRET)" "$(UPDATE_SERVER)/build/publish?name=$(PROJECT)&platform=ebitengine&version=$$VERSION"
|
||||||
|
|
||||||
.PHONY: all build wasm export watch clean binaries binaries-mac mac-release binary-win-x86 binary-win-x64 binary-linux-x64 binary-mac-x64 binary-mac-arm64 binary-build binary-build-mac ci-version ci-export ci-binaries ci-upload ci-update
|
.PHONY: all build wasm export watch clean binaries binaries-mac mac-release binary-win-x86 binary-win-x64 binary-linux-x64 binary-mac-x64 binary-mac-arm64 binary-build binary-build-mac ci-version ci-export ci-binaries ci-upload ci-update
|
||||||
@@ -20,14 +20,11 @@ steps:
|
|||||||
- name: artifact
|
- name: artifact
|
||||||
image: alpine
|
image: alpine
|
||||||
environment:
|
environment:
|
||||||
DROPAREA_HOST: vps.teletype.hu
|
UPDATE_SERVER: https://teletypegames.org
|
||||||
DROPAREA_PORT: 2223
|
UPDATE_SECRET:
|
||||||
DROPAREA_TARGET_PATH: /home/drop
|
from_secret: update_secret_key
|
||||||
DROPAREA_USER: drop
|
|
||||||
DROPAREA_SSH_PASSWORD:
|
|
||||||
from_secret: droparea_ssh_password
|
|
||||||
commands:
|
commands:
|
||||||
- apk add --no-cache make openssh-client sshpass
|
- apk add --no-cache make curl
|
||||||
- make ci-upload
|
- make ci-upload
|
||||||
|
|
||||||
- name: update
|
- name: update
|
||||||
|
|||||||
Reference in New Issue
Block a user