1 name: AUR Release
2
3 # Dispatched by release-github.yml once the release and its checksums exist.
4 #
5 # Publishes the `sigit-bin` package: a prebuilt binary rather than a source
6 # build, so Arch users are not compiling the whole dependency tree (and the
7 # on-device inference stack in particular) to install a CLI.
8 on:
9 workflow_dispatch:
10 inputs:
11 tag:
12 description: "Release tag (e.g. v1.5.2)"
13 required: true
14
15 concurrency:
16 # A re-pushed or re-dispatched tag fires this a second time. Queue the
17 # duplicate behind the original instead of cancelling it: cancelling a run
18 # mid-publish can leave a channel half-uploaded, whereas a queued duplicate
19 # just hits the "already published" check and exits clean.
20 group: ${{ github.workflow }}-${{ github.event.inputs.tag || github.ref_name }}
21 cancel-in-progress: false
22
23 permissions:
24 contents: read
25
26 env:
27 REPO: getsigit/sigit
28
29 jobs:
30 publish-aur-package:
31 name: Publish sigit-bin to the AUR
32 runs-on: ubuntu-latest
33
34 steps:
35 - name: Checkout
36 uses: actions/checkout@v6
37 with:
38 ref: ${{ github.event.inputs.tag }}
39
40 - name: Resolve tag and version
41 id: release
42 shell: bash
43 run: |
44 TAG="${{ github.event.inputs.tag }}"
45 VERSION="${TAG#v}"
46
47 echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
48 echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
49
50 - name: Read SHA256 checksums from release
51 id: sha
52 env:
53 GH_TOKEN: ${{ github.token }}
54 shell: bash
55 run: |
56 mkdir -p artifacts
57
58 gh release download "${{ steps.release.outputs.tag }}" \
59 --repo "${{ env.REPO }}" \
60 --pattern "sigit-linux-*.sha256" \
61 --dir artifacts/
62
63 X86_64_SHA=$(cat artifacts/sigit-linux-amd64.sha256)
64 AARCH64_SHA=$(cat artifacts/sigit-linux-arm64.sha256)
65
66 echo "x86_64=${X86_64_SHA}" >> "$GITHUB_OUTPUT"
67 echo "aarch64=${AARCH64_SHA}" >> "$GITHUB_OUTPUT"
68
69 echo "x86_64 SHA256: ${X86_64_SHA}"
70 echo "aarch64 SHA256: ${AARCH64_SHA}"
71
72 - name: Render PKGBUILD
73 shell: bash
74 run: |
75 mkdir -p aur-build
76
77 sed \
78 -e "s/@VERSION@/${{ steps.release.outputs.version }}/g" \
79 -e "s/@SHA256_X86_64@/${{ steps.sha.outputs.x86_64 }}/g" \
80 -e "s/@SHA256_AARCH64@/${{ steps.sha.outputs.aarch64 }}/g" \
81 packaging/aur/PKGBUILD.in > aur-build/PKGBUILD
82
83 if grep -q '@[A-Z0-9_]*@' aur-build/PKGBUILD; then
84 echo "::error::PKGBUILD still contains unsubstituted placeholders" >&2
85 grep -n '@[A-Z0-9_]*@' aur-build/PKGBUILD >&2
86 exit 1
87 fi
88
89 # Catches an unbalanced quote or paren before it reaches the AUR.
90 bash -n aur-build/PKGBUILD
91
92 echo "Rendered PKGBUILD:"
93 cat aur-build/PKGBUILD
94
95 # The action runs makepkg in an Arch container to generate .SRCINFO and
96 # pushes over SSH. Generating .SRCINFO by hand is possible but drifts
97 # from the PKGBUILD the moment a field is added.
98 - name: Publish to the AUR
99 uses: KSXGitHub/github-actions-deploy-aur@v3
100 with:
101 pkgname: sigit-bin
102 pkgbuild: aur-build/PKGBUILD
103 commit_username: ${{ secrets.AUR_USERNAME }}
104 commit_email: ${{ secrets.AUR_EMAIL }}
105 ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
106 commit_message: "Update sigit-bin to ${{ steps.release.outputs.version }}"
107 updpkgsums: false