Publish to AUR #24
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
| name: Publish to AUR | |
| on: | |
| workflow_run: | |
| workflows: ["Release"] | |
| types: [completed] | |
| jobs: | |
| aur: | |
| runs-on: ubuntu-latest | |
| if: github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Extract version | |
| id: version | |
| run: echo "pkgver=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT" | |
| - name: Generate PKGBUILD | |
| env: | |
| PKGVER: ${{ steps.version.outputs.pkgver }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| # Download the source tarball and compute its checksum | |
| SOURCE_URL="https://github.com/${REPO}/archive/refs/tags/v${PKGVER}.tar.gz" | |
| SHA256=$(curl -sL "$SOURCE_URL" | sha256sum | cut -d' ' -f1) | |
| cat > PKGBUILD <<'HEREDOC' | |
| # Maintainer: bjarneo <https://github.com/bjarneo> | |
| pkgname=cliamp | |
| pkgver=PKGVER_PLACEHOLDER | |
| pkgrel=1 | |
| pkgdesc='A retro terminal music player inspired by Winamp 2.x' | |
| arch=('x86_64' 'aarch64') | |
| url='https://github.com/bjarneo/cliamp' | |
| license=('MIT') | |
| depends=('alsa-lib' 'flac' 'libvorbis' 'libogg' 'ffmpeg' 'yt-dlp') | |
| makedepends=('go') | |
| source=("${pkgname}-${pkgver}.tar.gz::https://github.com/bjarneo/cliamp/archive/refs/tags/v${pkgver}.tar.gz") | |
| sha256sums=('SHA256_PLACEHOLDER') | |
| build() { | |
| cd "${pkgname}-${pkgver}" | |
| export CGO_ENABLED=1 | |
| go build -trimpath -buildmode=pie \ | |
| -ldflags="-s -w -X main.version=v${pkgver} -linkmode=external" \ | |
| -o cliamp . | |
| } | |
| package() { | |
| cd "${pkgname}-${pkgver}" | |
| install -Dm755 cliamp "${pkgdir}/usr/bin/cliamp" | |
| } | |
| HEREDOC | |
| # Remove leading whitespace from heredoc | |
| sed -i 's/^ //' PKGBUILD | |
| # Replace placeholders with actual values | |
| sed -i "s/PKGVER_PLACEHOLDER/${PKGVER}/" PKGBUILD | |
| sed -i "s/SHA256_PLACEHOLDER/${SHA256}/" PKGBUILD | |
| cat PKGBUILD | |
| - name: Publish to AUR | |
| uses: KSXGitHub/github-actions-deploy-aur@v4.1.1 | |
| with: | |
| pkgname: cliamp | |
| pkgbuild: ./PKGBUILD | |
| commit_username: ${{ secrets.AUR_USERNAME }} | |
| commit_email: ${{ secrets.AUR_EMAIL }} | |
| ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
| commit_message: "Update to v${{ steps.version.outputs.pkgver }}" |