Add automated upstream update workflow
CI / Validate scripts and pinned versions (push) Canceled after 0s
CI / Build Flatpak (push) Canceled after 0s
CI / Auto-merge update PR (push) Canceled after 0s

update-version.sh bumps the pinned Patchwork release: it fetches the latest
upstream tag, downloads both tar.gz assets, updates versions.sh, the manifest
and the metainfo, then self-validates with check-versions.sh. A daily cron
workflow commits the bump and opens a PR labeled automerge; the CI workflow
builds the Flatpak in the freedesktop-24.08 container and auto-merges the PR
once the checks pass.
This commit is contained in:
2026-08-13 01:20:42 +02:00
parent 9e6bc3aaae
commit 35326a0e33
4 changed files with 258 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: write
pull-requests: write
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Validate scripts and pinned versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Shell syntax check
run: bash -n build.sh check-versions.sh update-version.sh versions.sh
- name: Validate pinned versions
run: ./check-versions.sh
build:
name: Build Flatpak
runs-on: ubuntu-latest
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-24.08
options: --privileged
steps:
- uses: actions/checkout@v4
- name: Install Electron base app
run: |
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install -y flathub org.electronjs.Electron2.BaseApp//24.08
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: patchwork.flatpak
manifest-path: nz.scuttlebutt.Patchwork.yaml
verbose: true
merge:
name: Auto-merge update PR
runs-on: ubuntu-latest
needs: [check, build]
if: |
github.event_name == 'pull_request' &&
github.event.pull_request.state == 'open' &&
github.event.pull_request.user.login == 'github-actions[bot]' &&
contains(github.event.pull_request.labels.*.name, 'automerge') &&
(github.event.pull_request.mergeable_state == 'clean' ||
github.event.pull_request.mergeable_state == 'behind')
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Update branch if behind
if: github.event.pull_request.mergeable_state == 'behind'
run: gh pr update-branch "${{ github.event.pull_request.number }}"
- name: Merge
run: gh pr merge --squash --delete-branch "${{ github.event.pull_request.number }}"
+67
View File
@@ -0,0 +1,67 @@
name: Update upstream release
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
concurrency:
group: update-patchwork
cancel-in-progress: true
jobs:
update:
name: Bump to latest Patchwork release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update pinned version
run: ./update-version.sh
- name: Check for changes
id: changes
run: |
if git diff --quiet; then
echo "No upstream changes."
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Open pull request
if: steps.changes.outputs.changed == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
source ./versions.sh
BRANCH="update-patchwork-${APP_VERSION}"
if git ls-remote --exit-code --heads origin "${BRANCH}" >/dev/null 2>&1; then
echo "Branch ${BRANCH} already exists (a PR is probably open); nothing to do."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b "${BRANCH}"
git add versions.sh nz.scuttlebutt.Patchwork.yaml nz.scuttlebutt.Patchwork.metainfo.xml
git commit -m "Update Patchwork to ${APP_VERSION}"
git push -u origin "${BRANCH}"
BODY=$(cat <<EOF
Bump the pinned Patchwork (Poncho Wonky) release to **${APP_VERSION}**.
- x86_64 sha256: \`${APP_SHA256_X86_64}\`
- aarch64 sha256: \`${APP_SHA256_AARCH64}\`
See https://github.com/soapdog/patchwork/releases/tag/v${APP_VERSION}
CI builds the manifest and this PR auto-merges once the checks pass.
EOF
)
gh pr create --label automerge \
--title "Update Patchwork to ${APP_VERSION}" \
--body "$BODY"