# Example consuming workflow. Drop this in a WoW interface repo (e.g. GlueXML) # at .gitea/workflows/release.yml. Pushing a tag like `v1.0.0` builds the MPQ # and attaches it to a matching Gitea release. # # Requires: Actions enabled on the repo, and a runner advertising `ubuntu-latest` # with Docker available. # # 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: push: tags: - "v*" jobs: package: runs-on: ubuntu-latest steps: - 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 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="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" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":false,\"prerelease\":false}" \ | python3 -c 'import sys,json;print(json.load(sys.stdin)["id"])') curl -fsSL -X POST "$API/releases/$RID/assets?name=patch-Z.mpq" \ -H "Authorization: token $TOKEN" \ -H "Content-Type: application/octet-stream" \ --data-binary "@patch-Z.mpq" echo "Released $TAG with patch-Z.mpq"