From b59404742342069ad7df85a08d745c576d726d49 Mon Sep 17 00:00:00 2001 From: Xuc Pan Date: Sat, 5 Sep 2026 14:00:15 +0800 Subject: [PATCH] ci(release): build pacman packages with makepkg Build conventional artifacts on Ubuntu and the Arch package in an Arch container, merge both artifact sets, generate one checksum manifest, and publish them together. Allow an explicit manual rebuild to refresh AUR metadata. --- .github/workflows/release.yml | 88 +++++++++++++++++++++++++++++------ 1 file changed, 74 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0db450b..be91087 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,12 +9,17 @@ on: description: Existing GitHub Release tag to rebuild required: true type: string + publish_aur: + description: Publish or refresh the AUR package metadata + required: false + default: false + type: boolean permissions: contents: write jobs: - packages: + conventional-packages: runs-on: ubuntu-22.04 env: RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }} @@ -42,25 +47,76 @@ jobs: nfpm --version - name: Build distribution packages run: ./packaging/build-packages.sh - - name: Publish GitHub release assets - env: - GH_TOKEN: ${{ github.token }} - run: | - gh release upload "$RELEASE_TAG" \ - dist/*.tar.zst dist/*.deb dist/*.rpm dist/SHA256SUMS \ - --clobber + - uses: actions/upload-artifact@v4 + with: + name: conventional-packages + path: | + dist/*.deb + dist/*.rpm + dist/*-linux-*.tar.zst + if-no-files-found: error - aur: - needs: packages + arch-package: runs-on: ubuntu-latest container: archlinux:base-devel - if: ${{ github.event_name == 'release' }} - env: - RELEASE_TAG: ${{ github.event.release.tag_name }} steps: - uses: actions/checkout@v4 with: - ref: ${{ github.event.release.tag_name }} + ref: ${{ github.event.release.tag_name || inputs.tag }} + - name: Install Arch build dependencies + run: | + pacman -Syu --noconfirm \ + cargo rust gcc pkgconf pipewire \ + mingw-w64-gcc mingw-w64-binutils + - name: Build native pacman package with makepkg + run: | + useradd --create-home builder + chown -R builder:builder "$GITHUB_WORKSPACE" + runuser -u builder -- bash -lc ' + cd "$1" + CARGO_BUILD_JOBS=2 cargo build --release --locked + ./hook/build.sh + ./capture/build.sh + ./packaging/build-arch-package.sh dist + ' _ "$GITHUB_WORKSPACE" + - uses: actions/upload-artifact@v4 + with: + name: arch-package + path: | + dist/*.pkg.tar.zst + !dist/uur-debug-*.pkg.tar.zst + if-no-files-found: error + + publish: + needs: [conventional-packages, arch-package] + runs-on: ubuntu-latest + env: + RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }} + steps: + - uses: actions/download-artifact@v4 + with: + pattern: '*-package*' + path: release-assets + merge-multiple: true + - name: Generate combined checksums + working-directory: release-assets + run: sha256sum -- *.deb *.rpm *.tar.zst > SHA256SUMS + - name: Publish GitHub release assets + env: + GH_TOKEN: ${{ github.token }} + run: gh release upload "$RELEASE_TAG" release-assets/* --clobber + + aur: + needs: publish + runs-on: ubuntu-latest + container: archlinux:base-devel + if: ${{ github.event_name == 'release' || inputs.publish_aur }} + env: + RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.tag_name || inputs.tag }} - name: Install publication tools run: pacman -Syu --noconfirm curl git openssh - name: Publish AUR metadata @@ -83,5 +139,9 @@ jobs: git -C aur config user.name uur-release-bot git -C aur config user.email actions@users.noreply.github.com git -C aur add PKGBUILD uur.install .SRCINFO + if git -C aur diff --cached --quiet; then + echo "AUR metadata is already current" + exit 0 + fi git -C aur commit -m "uur $version" GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes' git -C aur push