Switch the CI templates to the /build HTTP endpoints
This commit is contained in:
@@ -8,8 +8,8 @@ spirit as [tic80-tools](../tic80-tools).
|
|||||||
Woodpecker pipeline targets (`ci-version`, `ci-build`, `ci-artifact`,
|
Woodpecker pipeline targets (`ci-version`, `ci-build`, `ci-artifact`,
|
||||||
`ci-update`).
|
`ci-update`).
|
||||||
- `example-woodpecker.yaml` — Woodpecker pipeline: version → build
|
- `example-woodpecker.yaml` — Woodpecker pipeline: version → build
|
||||||
(Debian, `apt install acme`) → artifact (scp to the droparea) →
|
(Debian, `apt install acme`) → artifact (HTTP POST to `/build/upload`) →
|
||||||
update (calls the teletypegames `/update` endpoint with
|
update (calls the teletypegames `/build/publish` endpoint with
|
||||||
`platform=c64`).
|
`platform=c64`).
|
||||||
- `example-metadata.json` — catalog metadata; the `version` field drives
|
- `example-metadata.json` — catalog metadata; the `version` field drives
|
||||||
`ci-version`, the rest (`name`, `title`, `author`, `desc`, `site`,
|
`ci-version`, the rest (`name`, `title`, `author`, `desc`, `site`,
|
||||||
@@ -26,7 +26,7 @@ spirit as [tic80-tools](../tic80-tools).
|
|||||||
2. Copy `example-metadata.json` to `metadata.json` and fill it in;
|
2. Copy `example-metadata.json` to `metadata.json` and fill it in;
|
||||||
`name` must match `PROJECT`.
|
`name` must match `PROJECT`.
|
||||||
3. Copy `example-woodpecker.yaml` to `.woodpecker.yaml` and add the
|
3. 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.
|
||||||
4. Copy `example-tasks.json` to `.vscode/tasks.json`.
|
4. Copy `example-tasks.json` to `.vscode/tasks.json`.
|
||||||
|
|
||||||
## Builder image
|
## Builder image
|
||||||
@@ -43,6 +43,6 @@ docker push git.teletypegames.org/internal/c64-builder:latest
|
|||||||
```
|
```
|
||||||
|
|
||||||
The pipeline uploads `$(PROJECT)-$(VERSION).prg` and
|
The pipeline uploads `$(PROJECT)-$(VERSION).prg` and
|
||||||
`$(PROJECT)-$(VERSION).metadata.json` to the droparea, then triggers
|
`$(PROJECT)-$(VERSION).metadata.json` via `/build/upload`, then triggers
|
||||||
`/update?platform=c64&name=$(PROJECT)&version=$(VERSION)`, which
|
`/build/publish?platform=c64&name=$(PROJECT)&version=$(VERSION)`, which
|
||||||
creates/updates the Software row and a Release with `cartridge_path`.
|
creates/updates the Software row and a Release with `cartridge_path`.
|
||||||
|
|||||||
+6
-10
@@ -16,10 +16,6 @@ UNAME_S := $(shell uname -s)
|
|||||||
|
|
||||||
# CI/CD variables
|
# CI/CD variables
|
||||||
VERSION_FILE = .version
|
VERSION_FILE = .version
|
||||||
DROPAREA_HOST ?= vps.teletype.hu
|
|
||||||
DROPAREA_PORT ?= 2223
|
|
||||||
DROPAREA_TARGET_PATH ?= /home/drop
|
|
||||||
DROPAREA_USER ?= drop
|
|
||||||
UPDATE_SERVER ?= https://teletypegames.org
|
UPDATE_SERVER ?= https://teletypegames.org
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
@@ -77,15 +73,15 @@ ci-build: build
|
|||||||
ci-artifact:
|
ci-artifact:
|
||||||
@VERSION=$$(cat $(VERSION_FILE)); \
|
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||||
echo "==> Uploading artifacts for version $$VERSION"; \
|
echo "==> Uploading artifacts for version $$VERSION"; \
|
||||||
SCP_TARGET="$(DROPAREA_USER)@$(DROPAREA_HOST):$(DROPAREA_TARGET_PATH)/"; \
|
for f in $(PROJECT)-$$VERSION.prg $(PROJECT)-$$VERSION.metadata.json; do \
|
||||||
sshpass -p "$(DROPAREA_SSH_PASSWORD)" scp -o StrictHostKeyChecking=no -P $(DROPAREA_PORT) \
|
curl -fsS -H "X-Update-Secret: $(UPDATE_SECRET)" \
|
||||||
$(PROJECT)-$$VERSION.prg \
|
-F "file=@$$f" \
|
||||||
$(PROJECT)-$$VERSION.metadata.json \
|
"$(UPDATE_SERVER)/build/upload?name=$(PROJECT)&version=$$VERSION" || exit 1; \
|
||||||
$$SCP_TARGET
|
done
|
||||||
|
|
||||||
ci-update:
|
ci-update:
|
||||||
@VERSION=$$(cat $(VERSION_FILE)); \
|
@VERSION=$$(cat $(VERSION_FILE)); \
|
||||||
echo "==> Triggering update for version $$VERSION"; \
|
echo "==> Triggering update for version $$VERSION"; \
|
||||||
curl "$(UPDATE_SERVER)/update?secret=$(UPDATE_SECRET)&name=$(PROJECT)&platform=c64&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-update
|
.PHONY: all deps build run clear rebuild rebuildrun ci-version ci-build ci-artifact ci-update
|
||||||
|
|||||||
@@ -13,14 +13,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-artifact'
|
- 'make ci-artifact'
|
||||||
|
|
||||||
- name: update
|
- name: update
|
||||||
|
|||||||
Reference in New Issue
Block a user