From 4f00d0228cb4413ea33e7e2a92e2d89ffc62c15e Mon Sep 17 00:00:00 2001 From: T1Gu1 Date: Thu, 2 Jul 2026 02:08:13 -0400 Subject: [PATCH] ci: automate AUR package publishing on release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a release step to automatically generate and publish the PKGBUILD to the Arch User Repository (AUR) for the gitwand-bin package. Update Linux getting-started guide to highlight AUR availability. 🪄 Commit via GitWand --- .github/workflows/release.yml | 57 ++++++++++++++++++++++++++++++++ scripts/PKGBUILD.template | 29 ++++++++++++++++ website/guide/getting-started.md | 2 +- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 scripts/PKGBUILD.template diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05e3c1a4..9fe98234 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -251,3 +251,60 @@ jobs: path: website/.vitepress/dist - name: Deploy to GitHub Pages uses: actions/deploy-pages@v4 + + # After Linux and Windows releases succeed, publish the package to the AUR (Arch User Repository) + publish-aur: + name: Publish to AUR + needs: release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - name: Download Linux deb package from release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v}" + # Retry download as assets might take a minute to finalize + for attempt in 1 2 3; do + if gh release download "${{ github.ref_name }}" \ + --pattern "GitWand_${VERSION}_amd64.deb" \ + --dir . \ + --repo "${{ github.repository }}" 2>&1; then + break + fi + echo "::warning::Deb package not yet available on release ${{ github.ref_name }} (attempt $attempt/3) — sleeping 15s" + sleep 15 + done + [ -f "GitWand_${VERSION}_amd64.deb" ] || { echo "::error::Deb package missing or empty after retries"; exit 1; } + + - name: Generate PKGBUILD from template + run: | + set -euo pipefail + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v}" + + # Calculate checksums + SHA256_DEB=$(sha256sum "GitWand_${VERSION}_amd64.deb" | awk '{print $1}') + SHA256_LICENSE=$(sha256sum LICENSE | awk '{print $1}') + + # Replace placeholders in template + sed -e "s/#VERSION#/${VERSION}/g" \ + -e "s/#SHA256_DEB#/${SHA256_DEB}/g" \ + -e "s/#SHA256_LICENSE#/${SHA256_LICENSE}/g" \ + scripts/PKGBUILD.template > PKGBUILD + + echo "=== Generated PKGBUILD ===" + cat PKGBUILD + + - name: Publish AUR package + uses: KSXGitHub/github-actions-deploy-aur@v3 + with: + pkgname: gitwand-bin + pkgbuild: ./PKGBUILD + commit_username: ${{ secrets.AUR_USERNAME }} + commit_email: ${{ secrets.AUR_EMAIL }} + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + diff --git a/scripts/PKGBUILD.template b/scripts/PKGBUILD.template new file mode 100644 index 00000000..a3c42b0a --- /dev/null +++ b/scripts/PKGBUILD.template @@ -0,0 +1,29 @@ +# Maintainer: Laurent Guitton +# Contributor: GitWand Release Bot + +pkgname=gitwand-bin +pkgver=#VERSION# +pkgrel=1 +pkgdesc="Automatic Git merge conflict resolution desktop client" +arch=('x86_64') +url="https://github.com/devlint/GitWand" +license=('MIT') +depends=('webkit2gtk-4.1' 'gtk3' 'libayatana-appindicator' 'xdotool' 'nss' 'libxtst') +provides=('gitwand') +conflicts=('gitwand') +source_x86_64=( + "https://github.com/devlint/GitWand/releases/download/v${pkgver}/GitWand_${pkgver}_amd64.deb" + "LICENSE::https://raw.githubusercontent.com/devlint/GitWand/v${pkgver}/LICENSE" +) +sha256sums_x86_64=( + '#SHA256_DEB#' + '#SHA256_LICENSE#' +) + +package() { + # Extract the Debian data file + bsdtar -xf data.tar.* -C "${pkgdir}" + + # Install the license file + install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/" +} diff --git a/website/guide/getting-started.md b/website/guide/getting-started.md index f5ce2eb0..d3d4c813 100644 --- a/website/guide/getting-started.md +++ b/website/guide/getting-started.md @@ -12,7 +12,7 @@ GitWand is available as a desktop app, a CLI tool, and a VS Code extension. Inst Download the latest release for your platform: - **macOS** — `.dmg` (Universal: Apple Silicon + Intel) -- **Linux** — `.AppImage` or `.deb` +- **Linux** — `.AppImage` or `.deb` (also available in the AUR as `gitwand-bin`) - **Windows** — `.msi` or `.exe` 👉 [Download from GitHub Releases](https://github.com/devlint/GitWand/releases)