diff --git a/.gitea/workflows/arch-package.yml b/.gitea/workflows/arch-package.yml index 24bfd58..46aa816 100644 --- a/.gitea/workflows/arch-package.yml +++ b/.gitea/workflows/arch-package.yml @@ -1,8 +1,23 @@ name: Build & publish Arch package +# Keyed on the tag, not on main. It used to publish on every push, +# deriving a version from `git describe` — so the registry accumulated a +# package per merge and none of them corresponded to anything a user +# could be told to install. release.yml decides what a release is now, +# and this builds the tag it cuts. + on: push: - branches: [main] + tags: ["v*"] + workflow_dispatch: + inputs: + version: + description: "Version to build (default: the latest v* tag)" + required: false + +concurrency: + group: arch-${{ github.ref }} + cancel-in-progress: true jobs: arch-package: @@ -17,6 +32,7 @@ jobs: REPO: ${{ github.repository }} OWNER: ${{ github.repository_owner }} SHA: ${{ github.sha }} + REF_NAME: ${{ github.ref_name }} # Arch registry name (the "$repo" in clients' pacman.conf). Arbitrary label. ARCH_REPO: stable steps: @@ -26,8 +42,9 @@ jobs: # gtk3 was v2's stack and is now only the `-tags gtk3` escape hatch. # These must match the PKGBUILD's depends=() — makepkg installs # nothing itself, so a mismatch fails at link time, not at check time. + # jq is scripts/release-asset.sh's, not the build's. pacman -Syu --noconfirm --needed \ - base-devel git go nodejs pnpm curl sudo \ + base-devel git go nodejs pnpm curl sudo jq \ webkitgtk-6.0 gtk4 alsa-lib - name: Create unprivileged build user @@ -36,15 +53,43 @@ jobs: install -d -o builder -g builder /build echo 'builder ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/builder + # v0.0.0 is semantic-release's version floor, not a shipment — see + # the bootstrap step in release.yml. A clean skip rather than a + # failure: a red run against a tag that was never meant to ship is + # noise, and this is one of the three workflows that would otherwise + # fire on it. + - name: Resolve the version + id: version + run: | + set -eu + v="${{ inputs.version }}" + [ -n "$v" ] || v="$REF_NAME" + case "$v" in v*) ;; *) v="v$v" ;; esac + + if [ "$v" = "v0.0.0" ]; then + echo "v0.0.0 is the version floor, not a release; nothing to build" + echo "skip=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + + echo "skip=false" >> "$GITHUB_OUTPUT" + echo "tag=$v" >> "$GITHUB_OUTPUT" + echo "building $v" + - name: Clone repo at the pushed commit + if: steps.version.outputs.skip == 'false' run: | # Token auth works for private repos and needs no SSH key in CI. sudo -u builder git clone \ "https://x-access-token:${PACKAGE_TOKEN}@${SERVER_URL#https://}/${REPO}.git" \ /build/yellowjacket + # A tag push carries the tag's own commit in $SHA, so this checks + # out exactly what was tagged. pkgver() then reads the tag from + # the clone's own git history. sudo -u builder git -C /build/yellowjacket checkout --detach "$SHA" - name: Build package with makepkg + if: steps.version.outputs.skip == 'false' run: | cd /build/yellowjacket/packaging/arch # Point the PKGBUILD at this local clone / exact commit; pkgver() then @@ -54,6 +99,7 @@ jobs: makepkg -f --noconfirm --cleanbuild - name: Publish to the Gitea Arch registry + if: steps.version.outputs.skip == 'false' run: | cd /build/yellowjacket/packaging/arch # makepkg also produces a -debug package (detached symbols); end users @@ -67,3 +113,20 @@ jobs: --upload-file "$pkg" \ "${SERVER_URL}/api/packages/${OWNER}/arch/${ARCH_REPO}" done + + # The pacman registry is for people who have added it to pacman.conf; + # the release page is for everyone else. Same file, and it is + # already built. + - name: Attach the package to the release + if: steps.version.outputs.skip == 'false' + env: + TAG: ${{ steps.version.outputs.tag }} + run: | + set -eu + cd /build/yellowjacket/packaging/arch + for pkg in yellowjacket-*.pkg.tar.zst; do + case "$pkg" in + yellowjacket-debug-*) continue ;; + esac + /build/yellowjacket/scripts/release-asset.sh "$TAG" "$(pwd)/$pkg" + done diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD index e2fa916..d6d2949 100644 --- a/packaging/arch/PKGBUILD +++ b/packaging/arch/PKGBUILD @@ -1,6 +1,17 @@ # Maintainer: yonlu pkgname=yellowjacket -pkgver=1.3.0 +# A fallback and the default tag for a manual build; pkgver() below is what +# actually decides the version, from the clone's own git history. Versions +# restarted at 0.0.1 when releases became automatic (plan 017) — which is a +# *downgrade* from the 1.x packages already in the registry, so pacman offers +# no upgrade and an existing install has to be removed and reinstalled once: +# +# pacman -R yellowjacket && pacman -S yellowjacket +# +# `epoch=1` would have avoided that for one line, and was declined: an epoch +# can never be removed, and it would put a permanent `1:` in front of every +# version string this package will ever have. +pkgver=0.0.1 pkgrel=1 pkgdesc="Cross-platform desktop music player — local library, MusicBrainz explore & auto-tag" arch=('x86_64')