fix(packaging): stop publishing an Arch package on every merge to main
arch-package.yml ran on push to main and took its version from `git describe`, so the pacman registry accumulated one package per merge and not one of them corresponded to a version a user could be told to install. It builds the tag release.yml cuts instead. pkgver's literal drops to 0.0.1 with it. That is a downgrade from the 1.x already in the registry, so pacman offers no upgrade and an existing install has to be removed once; epoch=1 would have avoided that and is declined in a comment, because an epoch can never be removed again.
This commit is contained in:
@@ -1,8 +1,23 @@
|
|||||||
name: Build & publish Arch package
|
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:
|
on:
|
||||||
push:
|
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:
|
jobs:
|
||||||
arch-package:
|
arch-package:
|
||||||
@@ -17,6 +32,7 @@ jobs:
|
|||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
OWNER: ${{ github.repository_owner }}
|
OWNER: ${{ github.repository_owner }}
|
||||||
SHA: ${{ github.sha }}
|
SHA: ${{ github.sha }}
|
||||||
|
REF_NAME: ${{ github.ref_name }}
|
||||||
# Arch registry name (the "$repo" in clients' pacman.conf). Arbitrary label.
|
# Arch registry name (the "$repo" in clients' pacman.conf). Arbitrary label.
|
||||||
ARCH_REPO: stable
|
ARCH_REPO: stable
|
||||||
steps:
|
steps:
|
||||||
@@ -26,8 +42,9 @@ jobs:
|
|||||||
# gtk3 was v2's stack and is now only the `-tags gtk3` escape hatch.
|
# gtk3 was v2's stack and is now only the `-tags gtk3` escape hatch.
|
||||||
# These must match the PKGBUILD's depends=() — makepkg installs
|
# These must match the PKGBUILD's depends=() — makepkg installs
|
||||||
# nothing itself, so a mismatch fails at link time, not at check time.
|
# 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 \
|
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
|
webkitgtk-6.0 gtk4 alsa-lib
|
||||||
|
|
||||||
- name: Create unprivileged build user
|
- name: Create unprivileged build user
|
||||||
@@ -36,15 +53,43 @@ jobs:
|
|||||||
install -d -o builder -g builder /build
|
install -d -o builder -g builder /build
|
||||||
echo 'builder ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/builder
|
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
|
- name: Clone repo at the pushed commit
|
||||||
|
if: steps.version.outputs.skip == 'false'
|
||||||
run: |
|
run: |
|
||||||
# Token auth works for private repos and needs no SSH key in CI.
|
# Token auth works for private repos and needs no SSH key in CI.
|
||||||
sudo -u builder git clone \
|
sudo -u builder git clone \
|
||||||
"https://x-access-token:${PACKAGE_TOKEN}@${SERVER_URL#https://}/${REPO}.git" \
|
"https://x-access-token:${PACKAGE_TOKEN}@${SERVER_URL#https://}/${REPO}.git" \
|
||||||
/build/yellowjacket
|
/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"
|
sudo -u builder git -C /build/yellowjacket checkout --detach "$SHA"
|
||||||
|
|
||||||
- name: Build package with makepkg
|
- name: Build package with makepkg
|
||||||
|
if: steps.version.outputs.skip == 'false'
|
||||||
run: |
|
run: |
|
||||||
cd /build/yellowjacket/packaging/arch
|
cd /build/yellowjacket/packaging/arch
|
||||||
# Point the PKGBUILD at this local clone / exact commit; pkgver() then
|
# Point the PKGBUILD at this local clone / exact commit; pkgver() then
|
||||||
@@ -54,6 +99,7 @@ jobs:
|
|||||||
makepkg -f --noconfirm --cleanbuild
|
makepkg -f --noconfirm --cleanbuild
|
||||||
|
|
||||||
- name: Publish to the Gitea Arch registry
|
- name: Publish to the Gitea Arch registry
|
||||||
|
if: steps.version.outputs.skip == 'false'
|
||||||
run: |
|
run: |
|
||||||
cd /build/yellowjacket/packaging/arch
|
cd /build/yellowjacket/packaging/arch
|
||||||
# makepkg also produces a -debug package (detached symbols); end users
|
# makepkg also produces a -debug package (detached symbols); end users
|
||||||
@@ -67,3 +113,20 @@ jobs:
|
|||||||
--upload-file "$pkg" \
|
--upload-file "$pkg" \
|
||||||
"${SERVER_URL}/api/packages/${OWNER}/arch/${ARCH_REPO}"
|
"${SERVER_URL}/api/packages/${OWNER}/arch/${ARCH_REPO}"
|
||||||
done
|
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
|
||||||
|
|||||||
+12
-1
@@ -1,6 +1,17 @@
|
|||||||
# Maintainer: yonlu <yj@yellowjacket.app>
|
# Maintainer: yonlu <yj@yellowjacket.app>
|
||||||
pkgname=yellowjacket
|
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
|
pkgrel=1
|
||||||
pkgdesc="Cross-platform desktop music player — local library, MusicBrainz explore & auto-tag"
|
pkgdesc="Cross-platform desktop music player — local library, MusicBrainz explore & auto-tag"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
|
|||||||
Reference in New Issue
Block a user