Files
qbz/.github/workflows/release-gentoo.yml
T
victorrhgap 1fc4a4d5a9 fix(ci): generate Manifest digests in Gentoo overlay workflow
Ebuilds without matching Manifest hashes cause 'Missing digest'
errors on emerge. Download DIST files and compute BLAKE2B/SHA512
for ebuilds, metadata.xml, and tarballs.

cc
2026-03-25 23:04:15 -06:00

165 lines
5.5 KiB
YAML

name: release-gentoo
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
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}..."
if curl -sLf "$url" -o "/tmp/${dist_name}"; then
MANIFEST+="$(manifest_line DIST "$dist_name" "/tmp/${dist_name}")"$'\n'
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