Rewrite example release workflow to the proven subpath-safe pattern
CI / build-and-smoke (push) Successful in 4s

Manual clone + docker build + docker cp instead of actions/checkout and
'uses:' (both broken by the /git subpath). Pins packager @v1.
This commit is contained in:
2026-06-25 22:51:19 -05:00
parent b659386bd2
commit 25737953d8
+39 -26
View File
@@ -3,11 +3,15 @@
# and attaches it to a matching Gitea release.
#
# Requires: Actions enabled on the repo, and a runner advertising `ubuntu-latest`
# (or change runs-on to a label your act_runner registers).
# with Docker available.
#
# NOTE: octowow.st is served under the /git subpath. act_runner reports
# GITHUB_SERVER_URL without it, breaking checkout and the release API calls, so
# we pin GITHUB_SERVER_URL below. Drop this once the server's ROOT_URL is fixed.
# NOTE on octowow.st: the instance is served under the /git subpath, but Gitea
# generates URLs without it, which breaks actions/checkout and `uses:` action
# resolution. So this workflow avoids both: it clones manually against the
# correct base and runs the packager via `docker build` + `docker cp` (bind
# mounts don't work either — the inner docker uses the host daemon). Once the
# server's ROOT_URL is fixed, this can be simplified to actions/checkout +
# `uses: paste/mpq-packager@v1`.
name: Release MPQ
on:
@@ -18,39 +22,48 @@ on:
jobs:
package:
runs-on: ubuntu-latest
env:
GITHUB_SERVER_URL: https://octowow.st/git
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout (manual; instance under /git)
run: |
git init -q .
git remote add origin "https://gitea:${{ secrets.GITHUB_TOKEN }}@octowow.st/git/${{ github.repository }}.git"
git fetch -q --depth 1 origin "${{ github.ref }}"
git checkout -q FETCH_HEAD
- name: Build packager image
run: |
git clone -q --depth 1 --branch v1 \
"https://gitea:${{ secrets.GITHUB_TOKEN }}@octowow.st/git/paste/mpq-packager.git" /tmp/packager
docker build -q -t mpq-packager /tmp/packager
- name: Build patch MPQ
id: pack
uses: paste/mpq-packager@v1
with:
manifest: mpq.yaml
version: ${{ github.ref_name }}
run: |
set -euo pipefail
cid=$(docker create \
-e INPUT_MANIFEST=mpq.yaml \
-e INPUT_VERSION=${{ github.ref_name }} \
-e INPUT_OUT_DIR=/work/dist \
-e GITHUB_WORKSPACE=/work \
mpq-packager)
docker cp . "$cid:/work"
docker start -a "$cid"
docker cp "$cid:/work/dist/patch-Z.mpq" ./patch-Z.mpq
docker rm "$cid" >/dev/null
ls -l patch-Z.mpq
- name: Create release and upload asset
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}"
TAG="${GITHUB_REF_NAME}"
MPQ="${{ steps.pack.outputs.mpq-path }}"
NAME="${{ steps.pack.outputs.mpq-name }}"
echo "Creating release $TAG"
API="https://octowow.st/git/api/v1/repos/${{ github.repository }}"
TAG="${{ github.ref_name }}"
RID=$(curl -fsSL -X POST "$API/releases" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":false,\"prerelease\":false}" \
| python3 -c 'import sys,json;print(json.load(sys.stdin)["id"])')
echo "Uploading $NAME to release $RID"
curl -fsSL -X POST "$API/releases/$RID/assets?name=$NAME" \
curl -fsSL -X POST "$API/releases/$RID/assets?name=patch-Z.mpq" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$MPQ"
echo "Done."
--data-binary "@patch-Z.mpq"
echo "Released $TAG with patch-Z.mpq"