Files
sirmem/.gitea/workflows/release.yml
T
SirStone 02072213a5
ci / test (push) Canceled after 0s
ci / release (push) Canceled after 0s
ci: run in nixos/nix container, shell-only steps
2026-11-22 16:23:14 +01:00

73 lines
2.5 KiB
YAML

# Gitea Actions. Every job runs in a pinned nixos/nix container with plain shell steps only:
# the runner image has no Node, so JavaScript actions (actions/checkout, ...) cannot run.
# Tooling comes from devbox (nix run nixpkgs#devbox), which honours devbox.lock like local runs.
# Release upload goes through the Gitea REST API with the built-in job token.
name: ci
on:
push:
branches: ["**"]
tags: ["v*"]
env:
NIX_CONFIG: |
experimental-features = nix-command flakes
sandbox = false
filter-syscalls = false
jobs:
test:
runs-on: ubuntu-latest
container: nixos/nix:2.36.0
steps:
- name: Prepare tools
run: |
set -euo pipefail
nix profile install nixpkgs#git nixpkgs#curl nixpkgs#devbox
git --version && devbox version
- 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
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: test
runs-on: ubuntu-latest
container: nixos/nix:2.36.0
steps:
- name: Prepare tools
run: |
set -euo pipefail
nix profile install nixpkgs#git nixpkgs#curl nixpkgs#devbox
- 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
devbox 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