Files
sirmem/.gitea/workflows/release.yml
T
SirStone bf33ba2577
ci / test (push) Canceled after 0s
ci / release (push) Canceled after 0s
ci: shell-only steps, no Node/JS actions (runner is host-mode NixOS)
2026-11-22 16:19:29 +01:00

66 lines
2.3 KiB
YAML

# Gitea Actions. The runner (label ubuntu-latest) executes jobs directly on a NixOS host
# with no Node, so JavaScript actions (actions/checkout, ...) cannot run: every step here
# is plain shell. Tooling comes from devbox (found on PATH, else via `nix run nixpkgs#devbox`).
# Release upload goes through the Gitea REST API with the built-in token.
name: ci
on:
push:
branches: ["**"]
tags: ["v*"]
env:
NIX_CONFIG: "experimental-features = nix-command flakes"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
run: |
set -euo pipefail
git clone "${{ github.server_url }}/${{ github.repository }}.git" src
git -C src checkout --detach "${{ github.sha }}"
- name: Probe tools
run: command -v nix devbox git curl sha256sum || true
- name: Test
run: |
set -euo pipefail
cd src
if command -v devbox >/dev/null; then dv="devbox"; else dv="nix run nixpkgs#devbox --"; fi
$dv run test
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
run: |
set -euo pipefail
git clone "${{ github.server_url }}/${{ github.repository }}.git" src
git -C src checkout --detach "${{ github.sha }}"
- name: Build all targets and checksums
run: |
set -euo pipefail
cd src
if command -v devbox >/dev/null; then dv="devbox"; else dv="nix run nixpkgs#devbox --"; fi
$dv run cross-all
cd dist && sha256sum sirmem-* > SHA256SUMS && cat SHA256SUMS
- name: Create release and upload assets
env:
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\"}" | sed -n 's/.*"id":\([0-9]*\).*/\1/p' | head -1)
for f in dist/*; do
curl -fsS -X POST "$api/releases/$id/assets?name=$(basename "$f")" \
-H "Authorization: token $TOKEN" -F "attachment=@$f"
done