-
Notifications
You must be signed in to change notification settings - Fork 2
Add winget, Scoop, AUR, deb, and rpm release channels #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0685143
ccfaae9
c75bf63
3dbb970
9a05cdb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| name: AUR Release | ||
|
|
||
| # Dispatched by release-github.yml once the release and its checksums exist. | ||
| # | ||
| # Publishes the `sigit-bin` package: a prebuilt binary rather than a source | ||
| # build, so Arch users are not compiling the whole dependency tree (and the | ||
| # on-device inference stack in particular) to install a CLI. | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: "Release tag (e.g. v1.5.2)" | ||
| required: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| REPO: getsigit/sigit | ||
|
|
||
| jobs: | ||
| publish-aur-package: | ||
| name: Publish sigit-bin to the AUR | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ github.event.inputs.tag }} | ||
|
|
||
| - name: Resolve tag and version | ||
| id: release | ||
| shell: bash | ||
| run: | | ||
| TAG="${{ github.event.inputs.tag }}" | ||
| VERSION="${TAG#v}" | ||
|
|
||
| echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | ||
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Read SHA256 checksums from release | ||
| id: sha | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| shell: bash | ||
| run: | | ||
| mkdir -p artifacts | ||
|
|
||
| gh release download "${{ steps.release.outputs.tag }}" \ | ||
| --repo "${{ env.REPO }}" \ | ||
| --pattern "sigit-linux-*.sha256" \ | ||
| --dir artifacts/ | ||
|
|
||
| X86_64_SHA=$(cat artifacts/sigit-linux-amd64.sha256) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. critical — The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning — The SHA read here comes from the |
||
| AARCH64_SHA=$(cat artifacts/sigit-linux-arm64.sha256) | ||
|
|
||
| echo "x86_64=${X86_64_SHA}" >> "$GITHUB_OUTPUT" | ||
| echo "aarch64=${AARCH64_SHA}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| echo "x86_64 SHA256: ${X86_64_SHA}" | ||
| echo "aarch64 SHA256: ${AARCH64_SHA}" | ||
|
|
||
| - name: Render PKGBUILD | ||
| shell: bash | ||
| run: | | ||
| mkdir -p aur-build | ||
|
|
||
| sed \ | ||
| -e "s/@VERSION@/${{ steps.release.outputs.version }}/g" \ | ||
| -e "s/@SHA256_X86_64@/${{ steps.sha.outputs.x86_64 }}/g" \ | ||
| -e "s/@SHA256_AARCH64@/${{ steps.sha.outputs.aarch64 }}/g" \ | ||
| packaging/aur/PKGBUILD.in > aur-build/PKGBUILD | ||
|
|
||
| if grep -q '@[A-Z0-9_]*@' aur-build/PKGBUILD; then | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning — The placeholder grep There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit — The placeholder-detection regex |
||
| echo "::error::PKGBUILD still contains unsubstituted placeholders" >&2 | ||
| grep -n '@[A-Z0-9_]*@' aur-build/PKGBUILD >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Catches an unbalanced quote or paren before it reaches the AUR. | ||
| bash -n aur-build/PKGBUILD | ||
|
|
||
| echo "Rendered PKGBUILD:" | ||
| cat aur-build/PKGBUILD | ||
|
|
||
| # The action runs makepkg in an Arch container to generate .SRCINFO and | ||
| # pushes over SSH. Generating .SRCINFO by hand is possible but drifts | ||
| # from the PKGBUILD the moment a field is added. | ||
| - name: Publish to the AUR | ||
| uses: KSXGitHub/github-actions-deploy-aur@v3 | ||
| with: | ||
| pkgname: sigit-bin | ||
| pkgbuild: aur-build/PKGBUILD | ||
| commit_username: ${{ secrets.AUR_USERNAME }} | ||
| commit_email: ${{ secrets.AUR_EMAIL }} | ||
| ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | ||
| commit_message: "Update sigit-bin to ${{ steps.release.outputs.version }}" | ||
| updpkgsums: false | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,6 +119,54 @@ jobs: | |
| echo "Archive: ${ARCHIVE_NAME}" | ||
| echo "SHA256: $(cat "${ARCHIVE_NAME}.sha256")" | ||
|
|
||
| # Debian and RPM packages are built from the binary staged above rather | ||
| # than by re-invoking cargo, so each Linux target compiles once and gets | ||
| # packaged twice. | ||
| - name: Build Linux packages | ||
| if: contains(matrix.target, 'linux') | ||
| shell: bash | ||
| env: | ||
| NFPM_VERSION: "2.43.0" | ||
| run: | | ||
| case "$(uname -m)" in | ||
| x86_64) nfpm_arch="x86_64"; export PKG_ARCH="amd64" ;; | ||
| aarch64) nfpm_arch="arm64"; export PKG_ARCH="arm64" ;; | ||
| *) echo "Unsupported Linux build host $(uname -m)" >&2; exit 1 ;; | ||
| esac | ||
|
|
||
| curl -sSfL \ | ||
| "https://github.com/goreleaser/nfpm/releases/download/v${NFPM_VERSION}/nfpm_${NFPM_VERSION}_Linux_${nfpm_arch}.tar.gz" \ | ||
| | tar -xz -C /tmp nfpm | ||
|
|
||
| export PKG_VERSION="${RELEASE_VERSION}" | ||
| export PKG_BINARY="./release/${PROJECT_NAME}-${{ matrix.name }}" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning — There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning — |
||
|
|
||
| /tmp/nfpm package --config packaging/nfpm.yaml --packager deb --target ./release/ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning — |
||
| /tmp/nfpm package --config packaging/nfpm.yaml --packager rpm --target ./release/ | ||
|
|
||
| ls -la ./release/ | ||
|
|
||
| # Homebrew has always had a checksum because the tap needs one. Scoop, | ||
| # winget, and the AUR PKGBUILD each need one too, and they consume the | ||
| # raw binaries rather than the macOS tarball, so every asset gets a | ||
| # sidecar. Windows runners use bash from Git for Windows, which has | ||
| # sha256sum; macOS only has shasum. | ||
| - name: Checksum release assets | ||
| shell: bash | ||
| run: | | ||
| cd release | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning — The checksum step iterates |
||
| for asset in *; do | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning — The checksum loop runs on every matrix job but only Linux jobs produce There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning — The glob |
||
| case "${asset}" in *.sha256) continue ;; esac | ||
|
|
||
| if command -v sha256sum >/dev/null 2>&1; then | ||
| sha256sum "${asset}" | awk '{print $1}' > "${asset}.sha256" | ||
| else | ||
| shasum -a 256 "${asset}" | awk '{print $1}' > "${asset}.sha256" | ||
| fi | ||
|
|
||
| echo "${asset}: $(cat "${asset}.sha256")" | ||
| done | ||
|
|
||
| - name: Upload binary artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
|
|
@@ -171,17 +219,36 @@ jobs: | |
| tag_name: ${{ steps.tag.outputs.tag }} | ||
| files: release/* | ||
|
|
||
| - name: Trigger Homebrew release | ||
| # These channels all publish somewhere outside this repo (a tap, a Scoop | ||
| # bucket, microsoft/winget-pkgs, the AUR) and every one of them reads | ||
| # checksums off the release created above, so they hang off this job | ||
| # rather than firing on the tag directly. | ||
| - name: Trigger OS package manager releases | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| await github.rest.actions.createWorkflowDispatch({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| workflow_id: 'release-homebrew.yml', | ||
| ref: 'main', | ||
| inputs: { | ||
| tag: '${{ steps.tag.outputs.tag }}' | ||
| const tag = '${{ steps.tag.outputs.tag }}' | ||
| const workflows = [ | ||
| 'release-homebrew.yml', | ||
| 'release-scoop.yml', | ||
| 'release-winget.yml', | ||
| 'release-aur.yml', | ||
| ] | ||
|
|
||
| for (const workflow_id of workflows) { | ||
| try { | ||
| await github.rest.actions.createWorkflowDispatch({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| workflow_id, | ||
| ref: 'main', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning — Dispatches use |
||
| inputs: { tag }, | ||
| }) | ||
| console.log(`Dispatched ${workflow_id} for tag ${tag}`) | ||
| } catch (error) { | ||
| // One packaging channel being unconfigured (a missing secret, | ||
| // a bucket repo that does not exist yet) should not take the | ||
| // rest of the fan-out down with it. | ||
| core.warning(`Failed to dispatch ${workflow_id}: ${error.message}`) | ||
| } | ||
| }) | ||
| console.log('Dispatched release-homebrew.yml for tag ${{ steps.tag.outputs.tag }}') | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit —
actions/checkout@v6does not exist yet (latest stable is v4); this will fail at runtime when the action is resolved. Useactions/checkout@v4.