# Gitea Actions, triggered only by pushed v* tags (the runner is slow): tests, then release. # Runs on the NixOS host runner (label `nixos`, host mode) with plain shell steps only. # Tooling comes from the host's devbox (honours devbox.lock); cross gcc comes from nix shell. # Release upload goes through the Gitea REST API with the built-in job token. name: ci on: push: tags: ["v*"] jobs: release: runs-on: nixos steps: - name: Note about the token run: | echo "Note: github.token / GITHUB_TOKEN is Gitea's own per-job token (GitHub-compatible name). It only works on this repo, expires when the job ends, and nothing is sent to GitHub." - name: Checkout run: | set -euo pipefail git clone "${{ github.server_url }}/${{ github.repository }}.git" src git -C src checkout --detach "${{ github.sha }}" - name: Test run: cd src && devbox run test - name: Build all targets and checksums run: | set -euo pipefail cd src devbox run cross-all cd dist && sha256sum sirmem-* > SHA256SUMS && cat SHA256SUMS - name: Create release and upload assets env: # Note: github.token / GITHUB_TOKEN is Gitea's own per-job token (GitHub-compatible name). # It only works on this repo, expires when the job ends, and nothing is sent to GitHub. TOKEN: ${{ github.token }} SERVER: ${{ github.server_url }} REPO: ${{ github.repository }} TAG: ${{ github.ref_name }} run: | set -euo pipefail cd src api="$SERVER/api/v1/repos/$REPO" id=$(curl -fsS -X POST "$api/releases" \ -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\"}" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) for f in dist/*; do curl -fsS -X POST "$api/releases/$id/assets?name=$(basename "$f")" \ -H "Authorization: token $TOKEN" -F "attachment=@$f" done