Files
galdr/.gitea/workflows/release.yml
T
Bendik Aagaard LynghaugandClaude Opus 4.8 d2778e169a
Release / build (x86_64, ubuntu-latest, /sccache, x86_64-unknown-linux-gnu) (push) Successful in 2m3s
Release / build (aarch64, aarch64, /var/lib/gitea-runner/sccache, aarch64-unknown-linux-gnu) (push) Successful in 2m46s
Release / update-aur (push) Successful in 23s
galdr 0.1.0: terminal grid synthesizer (MIDI in, PipeWire out)
Signal flows downward through single-glyph unit generators; each MIDI note
voices the whole grid; the mix renders low-latency to PipeWire (reusing the
native path from spectrust). Grid edits recompile and hot-swap without
dropping audio. Pairs with orca (note/CC source) and spectrust (visualizer).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GLUwWE2KmFPzhKaf67tWbx
2026-09-13 13:24:18 +02:00

175 lines
7.0 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
include:
- arch: x86_64
target: x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
sccache_dir: /sccache
- arch: aarch64
target: aarch64-unknown-linux-gnu
runs-on: aarch64
sccache_dir: /var/lib/gitea-runner/sccache
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
# Compiled-crate cache via sccache. x86_64 uses /sccache (a persistent
# host dir bind-mounted into the job container by the runner config);
# aarch64 runs on the klokka host and uses a runner-owned dir.
- name: Set up sccache
run: |
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
echo "SCCACHE_DIR=${{ matrix.sccache_dir }}" >> "$GITHUB_ENV"
mkdir -p "${{ matrix.sccache_dir }}"
if ! command -v sccache >/dev/null 2>&1; then
V=0.8.2
curl -sSL "https://github.com/mozilla/sccache/releases/download/v${V}/sccache-v${V}-x86_64-unknown-linux-musl.tar.gz" | tar -xz
sudo install -m0755 "sccache-v${V}-x86_64-unknown-linux-musl/sccache" /usr/local/bin/sccache
fi
sccache --version
- name: Ensure build deps (libpipewire for output, alsa for MIDI, clang for bindgen)
run: |
if command -v apt-get >/dev/null; then
# Ephemeral container runner: safe to install into it.
SUDO=""; command -v sudo >/dev/null && SUDO=sudo
$SUDO apt-get update
$SUDO apt-get install -y libpipewire-0.3-dev libspa-0.2-dev libasound2-dev clang libclang-dev pkg-config
else
# Bare/host runner: never mutate it - require deps preinstalled.
missing=""
pkg-config --exists libpipewire-0.3 2>/dev/null || missing="$missing libpipewire(+dev headers)"
pkg-config --exists alsa 2>/dev/null || missing="$missing alsa-lib(+dev headers)"
command -v clang >/dev/null || missing="$missing clang"
if [ -n "$missing" ]; then
echo "::error::bare runner missing build deps:$missing — install once on the host; CI does not modify bare runners"
exit 1
fi
echo "bare runner already has libpipewire + alsa + clang"
fi
- name: Build
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Package
run: |
TAG=${{ gitea.ref_name }}
TARBALL="galdr-${TAG}-${{ matrix.arch }}.tar.gz"
mkdir pkg
cp target/${{ matrix.target }}/release/galdr pkg/
cp LICENSE pkg/
tar -czf "${TARBALL}" -C pkg .
sha256sum "${TARBALL}" > "${TARBALL}.sha256"
echo "TARBALL=${TARBALL}" >> $GITHUB_ENV
- name: Create release
run: |
curl -sX POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \
-d "{\"tag_name\":\"${{ gitea.ref_name }}\",\"name\":\"${{ gitea.ref_name }}\"}" \
--fail-with-body || true
- name: Upload assets
run: |
RELEASE_ID=$(curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/tags/${{ gitea.ref_name }}" \
| jq -r '.id')
for FILE in "${{ env.TARBALL }}" "${{ env.TARBALL }}.sha256"; do
EXISTING=$(curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets" \
| jq -r ".[] | select(.name == \"${FILE}\") | .id")
for AID in $EXISTING; do
curl -sX DELETE \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets/${AID}"
done
curl -sX POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/octet-stream" \
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=${FILE}" \
--data-binary "@${FILE}" --fail-with-body
done
update-aur:
needs: build
runs-on: aarch64
steps:
- uses: actions/checkout@v4
- name: Compute checksums and update PKGBUILD
run: |
TAG=${{ gitea.ref_name }}
BASE="${{ gitea.server_url }}/${{ gitea.repository }}/releases/download/${TAG}"
SUM_X86=$(curl -sL "${BASE}/galdr-${TAG}-x86_64.tar.gz" | sha256sum | cut -d' ' -f1)
SUM_AARCH=$(curl -sL "${BASE}/galdr-${TAG}-aarch64.tar.gz" | sha256sum | cut -d' ' -f1)
sed -i "s/sha256sums_x86_64=('.*')/sha256sums_x86_64=('${SUM_X86}')/" aur/PKGBUILD
sed -i "s/sha256sums_aarch64=('.*')/sha256sums_aarch64=('${SUM_AARCH}')/" aur/PKGBUILD
# Best-effort mirror to the instance Arch registry via a write:package
# REGISTRY_TOKEN secret; skipped + non-fatal when unset.
- name: Publish to the Arch package registry
continue-on-error: true
run: |
set -euo pipefail
if [ -z "${{ secrets.REGISTRY_TOKEN }}" ]; then
echo "::warning::REGISTRY_TOKEN not set — skipping Arch registry publish"
exit 0
fi
cd aur
for carch in aarch64 x86_64; do
pkgfile=$(CARCH="$carch" makepkg --packagelist | tail -1)
CARCH="$carch" makepkg -f --nodeps --noconfirm --skipinteg
curl --fail-with-body --user "bl:${{ secrets.REGISTRY_TOKEN }}" \
--upload-file "$pkgfile" \
"${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/arch/uhhm"
done
- name: Push to AUR
env:
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
run: |
install -dm700 ~/.ssh
echo "$AUR_SSH_KEY" > ~/.ssh/aur
chmod 600 ~/.ssh/aur
echo "Host aur.archlinux.org" >> ~/.ssh/config
echo " IdentityFile ~/.ssh/aur" >> ~/.ssh/config
echo " User aur" >> ~/.ssh/config
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null
rm -rf /tmp/aur-galdr
git clone ssh://aur@aur.archlinux.org/galdr.git /tmp/aur-galdr
cp aur/PKGBUILD /tmp/aur-galdr/
cd /tmp/aur-galdr
makepkg --printsrcinfo > .SRCINFO
git config user.name "Bendik Aagaard Lynghaug"
git config user.email "bendik.lynghaug@gmail.com"
git add PKGBUILD .SRCINFO
git commit -m "Update to ${{ gitea.ref_name }}"
git push origin master