100 lines
3.1 KiB
YAML
100 lines
3.1 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: 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
|