Publish AUR Package #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Publish to AUR after a release is created. | |
| # Called by cargo-dist as a post-announce job. | |
| name: Publish AUR Package | |
| on: | |
| workflow_call: | |
| inputs: | |
| plan: | |
| required: true | |
| type: string | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to publish (e.g., 0.1.21)' | |
| required: true | |
| type: string | |
| jobs: | |
| publish-aur: | |
| runs-on: ubuntu-latest | |
| if: ${{ inputs.version || !fromJson(inputs.plan).announcement_is_prerelease }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version | |
| id: version | |
| run: | | |
| # Use manual input if provided, otherwise extract from plan | |
| if [ -n "${{ inputs.version }}" ]; then | |
| VERSION="${{ inputs.version }}" | |
| else | |
| VERSION=$(echo '${{ inputs.plan }}' | jq -r '.announcement_tag' | sed 's/^v//') | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Download tarball and compute checksum | |
| id: checksum | |
| run: | | |
| URL="https://github.com/sinelaw/fresh/releases/download/v${{ steps.version.outputs.version }}/fresh-editor-x86_64-unknown-linux-gnu.tar.xz" | |
| echo "Downloading $URL" | |
| curl -fsSL "$URL" -o tarball.tar.xz | |
| SHA256=$(sha256sum tarball.tar.xz | cut -d' ' -f1) | |
| echo "sha256=$SHA256" >> "$GITHUB_OUTPUT" | |
| echo "Computed SHA256: $SHA256" | |
| - name: Clone AUR repo and update PKGBUILD | |
| run: | | |
| git clone https://aur.archlinux.org/fresh-editor.git aur-repo | |
| cd aur-repo | |
| sed -i "s/^pkgver=.*/pkgver=${{ steps.version.outputs.version }}/" PKGBUILD | |
| sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD | |
| sed -i 's/^sha256sums=.*/sha256sums=("${{ steps.checksum.outputs.sha256 }}" "SKIP")/' PKGBUILD | |
| echo "Updated PKGBUILD:" | |
| cat PKGBUILD | |
| - name: Publish AUR package | |
| uses: KSXGitHub/[email protected] | |
| with: | |
| pkgname: fresh-editor | |
| pkgbuild: ./aur-repo/PKGBUILD | |
| commit_username: ${{ secrets.AUR_USERNAME }} | |
| commit_email: ${{ secrets.AUR_EMAIL }} | |
| ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
| commit_message: "Update to ${{ steps.version.outputs.version }}" | |
| ssh_keyscan_types: ed25519 |