Files
qbz/.github/workflows/release-gentoo.yml
T
vicrodh 1d16d84468 ci(gentoo): require the amd64 dist in the overlay Manifest, retry downloads
A Manifest published without its amd64 DIST entry bricks emerge for
every amd64 user, which is worse than failing the job; a 3x30s retry
absorbs release-asset propagation lag right after the tag. Also
documents the #557 root cause at the top: the overlay must never be
edited by hand — an ebuild change without Manifest regeneration is a
guaranteed digest mismatch; template changes are republished by
re-dispatching this workflow.

cc
2026-07-06 20:30:49 -06:00

186 lines
6.6 KiB
YAML

name: release-gentoo
# The overlay repo (vicrodh/qbz-overlay) must NEVER be edited by hand: any
# ebuild change without a Manifest regeneration bricks emerge with a digest
# mismatch (issue #557 — the 2.0.0 RESTRICT edit was pushed manually and
# skipped the Manifest). Template changes between releases are published by
# re-running THIS workflow via workflow_dispatch with the released version.
on:
workflow_run:
workflows: ["release-linux"]
types: [completed]
workflow_dispatch:
inputs:
version:
description: "Version to publish (e.g. 1.2.0)"
required: true
type: string
concurrency:
group: gentoo-overlay
cancel-in-progress: false
permissions:
contents: read
jobs:
update-overlay:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || (github.event.workflow_run.conclusion == 'success' && startsWith(github.event.workflow_run.head_branch, 'v') && !contains(github.event.workflow_run.head_branch, '-rc')) }}
steps:
- name: Checkout app repo
uses: actions/checkout@v4
- name: Determine version
id: version
env:
EVENT_NAME: ${{ github.event_name }}
WORKFLOW_HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
DISPATCH_VERSION: ${{ inputs.version }}
run: |
if [[ "$EVENT_NAME" == "workflow_run" ]]; then
REF="$WORKFLOW_HEAD_BRANCH"
if [[ ! "$REF" =~ ^v[0-9]+(\.[0-9]+){1,3}([.-][0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid tag: $REF"
exit 1
fi
VERSION="${REF#v}"
else
VERSION="$DISPATCH_VERSION"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Version: $VERSION"
- name: Clone overlay repo
env:
OVERLAY_PAT: ${{ secrets.APT_REPO_TOKEN }}
run: |
git clone "https://x-access-token:${OVERLAY_PAT}@github.com/vicrodh/qbz-overlay.git" /tmp/qbz-overlay
cd /tmp/qbz-overlay
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Update binary ebuild
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
cd /tmp/qbz-overlay/media-sound/qbz-bin
# Remove old version ebuilds (keep metadata.xml)
rm -f qbz-bin-*.ebuild
# Copy template from app repo and update version
cp "${{ github.workspace }}/packaging/gentoo/qbz-bin.ebuild.template" "qbz-bin-${VERSION}.ebuild"
echo "=== qbz-bin-${VERSION}.ebuild ==="
cat "qbz-bin-${VERSION}.ebuild"
- name: Update source ebuild
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
cd /tmp/qbz-overlay/media-sound/qbz
# Remove old version ebuilds (keep metadata.xml)
rm -f qbz-*.ebuild
# Copy template from app repo and update version
cp "${{ github.workspace }}/packaging/gentoo/qbz.ebuild.template" "qbz-${VERSION}.ebuild"
echo "=== qbz-${VERSION}.ebuild ==="
cat "qbz-${VERSION}.ebuild"
- name: Generate Manifests
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
# Helper: compute BLAKE2B and SHA512 for a file, output Manifest line
manifest_line() {
local type="$1" name="$2" file="$3"
local size blake2b sha512
size=$(stat -c%s "$file")
blake2b=$(b2sum "$file" | awk '{print $1}')
sha512=$(sha512sum "$file" | awk '{print $1}')
echo "${type} ${name} ${size} BLAKE2B ${blake2b} SHA512 ${sha512}"
}
# --- qbz-bin Manifest ---
cd /tmp/qbz-overlay/media-sound/qbz-bin
MANIFEST=""
# Download DIST files and hash them. amd64 is REQUIRED: publishing a
# Manifest without its DIST entry bricks emerge for every amd64 user
# (digest missing), which is worse than failing this job. A short
# retry absorbs release-asset propagation lag right after the tag.
for arch_pair in "amd64:amd64" "aarch64:arm64"; do
arch="${arch_pair%%:*}"
dist_name="qbz_${VERSION}_${arch}.tar.gz"
url="https://github.com/vicrodh/qbz/releases/download/v${VERSION}/${dist_name}"
echo "Downloading ${dist_name}..."
ok=0
for attempt in 1 2 3; do
if curl -sLf "$url" -o "/tmp/${dist_name}"; then
ok=1
break
fi
echo "Attempt ${attempt} failed for ${dist_name}, retrying in 30s..."
sleep 30
done
if [[ "$ok" == 1 ]]; then
MANIFEST+="$(manifest_line DIST "$dist_name" "/tmp/${dist_name}")"$'\n'
elif [[ "$arch" == "amd64" ]]; then
echo "ERROR: required asset ${dist_name} not found at ${url}"
exit 1
else
echo "WARNING: ${dist_name} not found at ${url}, skipping"
fi
done
# Hash the ebuild itself
MANIFEST+="$(manifest_line EBUILD "qbz-bin-${VERSION}.ebuild" "qbz-bin-${VERSION}.ebuild")"$'\n'
# Hash metadata.xml
MANIFEST+="$(manifest_line MISC "metadata.xml" "metadata.xml")"$'\n'
echo "$MANIFEST" > Manifest
echo "=== qbz-bin Manifest ==="
cat Manifest
# --- qbz (source) Manifest ---
cd /tmp/qbz-overlay/media-sound/qbz
MANIFEST=""
# Download source tarball
dist_name="qbz-${VERSION}.tar.gz"
url="https://github.com/vicrodh/qbz/archive/refs/tags/v${VERSION}.tar.gz"
echo "Downloading source tarball..."
if curl -sLf "$url" -o "/tmp/${dist_name}"; then
MANIFEST+="$(manifest_line DIST "$dist_name" "/tmp/${dist_name}")"$'\n'
else
echo "WARNING: source tarball not found, skipping"
fi
# Hash the ebuild
MANIFEST+="$(manifest_line EBUILD "qbz-${VERSION}.ebuild" "qbz-${VERSION}.ebuild")"$'\n'
# Hash metadata.xml
MANIFEST+="$(manifest_line MISC "metadata.xml" "metadata.xml")"$'\n'
echo "$MANIFEST" > Manifest
echo "=== qbz Manifest ==="
cat Manifest
- name: Commit and push
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
cd /tmp/qbz-overlay
git add -A
if git diff --cached --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "Update to v${VERSION}"
git push