Publish to AUR #90
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@v6 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_branch }} | |
| - name: Extract version | |
| id: version | |
| run: | | |
| TAG="${{ github.event.workflow_run.head_branch }}" | |
| echo "pkgver=${TAG#v}" >> "$GITHUB_OUTPUT" | |
| - name: Generate PKGBUILD | |
| env: | |
| PKGVER: ${{ steps.version.outputs.pkgver }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| AMD64_URL="https://github.com/${REPO}/releases/download/v${PKGVER}/aether-linux-amd64" | |
| AMD64_SHA256=$(curl -sL "$AMD64_URL" | sha256sum | cut -d' ' -f1) | |
| ARM64_URL="https://github.com/${REPO}/releases/download/v${PKGVER}/aether-linux-arm64" | |
| ARM64_SHA256=$(curl -sL "$ARM64_URL" | sha256sum | cut -d' ' -f1) | |
| SOURCE_URL="https://github.com/${REPO}/archive/refs/tags/v${PKGVER}.tar.gz" | |
| SOURCE_SHA256=$(curl -sL "$SOURCE_URL" | sha256sum | cut -d' ' -f1) | |
| cat > PKGBUILD <<'HEREDOC' | |
| # Maintainer: Bjarne Øverli <bjarne@oever.li> | |
| pkgname=aether | |
| pkgver=PKGVER_PLACEHOLDER | |
| pkgrel=1 | |
| pkgdesc='Desktop theming application - extract colors from wallpapers and apply cohesive themes' | |
| arch=('x86_64' 'aarch64') | |
| url='https://github.com/omacom-io/aether' | |
| license=('MIT') | |
| depends=('webkit2gtk-4.1' 'gtk3') | |
| source=("aether-${pkgver}.tar.gz::https://github.com/omacom-io/aether/archive/refs/tags/v${pkgver}.tar.gz") | |
| source_x86_64=("aether-linux-amd64-${pkgver}::https://github.com/omacom-io/aether/releases/download/v${pkgver}/aether-linux-amd64") | |
| source_aarch64=("aether-linux-arm64-${pkgver}::https://github.com/omacom-io/aether/releases/download/v${pkgver}/aether-linux-arm64") | |
| sha256sums=('SOURCE_SHA256_PLACEHOLDER') | |
| sha256sums_x86_64=('AMD64_SHA256_PLACEHOLDER') | |
| sha256sums_aarch64=('ARM64_SHA256_PLACEHOLDER') | |
| noextract=("aether-linux-amd64-${pkgver}" "aether-linux-arm64-${pkgver}") | |
| package() { | |
| if [[ "$CARCH" == "x86_64" ]]; then | |
| install -Dm755 "${srcdir}/aether-linux-amd64-${pkgver}" "${pkgdir}/usr/bin/aether" | |
| elif [[ "$CARCH" == "aarch64" ]]; then | |
| install -Dm755 "${srcdir}/aether-linux-arm64-${pkgver}" "${pkgdir}/usr/bin/aether" | |
| fi | |
| cd "${srcdir}/aether-${pkgver}" | |
| install -Dm644 build/linux/aether.desktop "${pkgdir}/usr/share/applications/aether.desktop" | |
| install -Dm644 li.oever.aether.url-handler.desktop "${pkgdir}/usr/share/applications/li.oever.aether.url-handler.desktop" | |
| install -Dm644 icon.png "${pkgdir}/usr/share/pixmaps/aether.png" | |
| install -Dm644 assets/aether-icon-512.png "${pkgdir}/usr/share/icons/hicolor/512x512/apps/aether.png" | |
| install -Dm644 README.md "${pkgdir}/usr/share/doc/aether/README.md" | |
| } | |
| HEREDOC | |
| sed -i 's/^ //' PKGBUILD | |
| sed -i "s|PKGVER_PLACEHOLDER|${PKGVER}|" PKGBUILD | |
| sed -i "s|AMD64_SHA256_PLACEHOLDER|${AMD64_SHA256}|" PKGBUILD | |
| sed -i "s|ARM64_SHA256_PLACEHOLDER|${ARM64_SHA256}|" PKGBUILD | |
| sed -i "s|SOURCE_SHA256_PLACEHOLDER|${SOURCE_SHA256}|" PKGBUILD | |
| cat PKGBUILD | |
| - name: Publish to AUR | |
| env: | |
| AUR_SSH_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
| AUR_USERNAME: ${{ secrets.AUR_USERNAME }} | |
| AUR_EMAIL: ${{ secrets.AUR_EMAIL }} | |
| PKGVER: ${{ steps.version.outputs.pkgver }} | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "$AUR_SSH_KEY" > ~/.ssh/aur | |
| chmod 600 ~/.ssh/aur | |
| ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null | |
| cat >> ~/.ssh/config <<EOF | |
| Host aur.archlinux.org | |
| IdentityFile ~/.ssh/aur | |
| User aur | |
| EOF | |
| git clone ssh://aur@aur.archlinux.org/aether.git aur-repo | |
| cd aur-repo | |
| git config user.name "$AUR_USERNAME" | |
| git config user.email "$AUR_EMAIL" | |
| cp ../PKGBUILD . | |
| docker run --rm -v "$PWD/PKGBUILD:/PKGBUILD:ro" archlinux:base bash -c \ | |
| 'pacman -Sy --noconfirm pacman-contrib >&2 && cp /PKGBUILD /tmp/ && cd /tmp && chown nobody PKGBUILD && runuser -u nobody -- makepkg --printsrcinfo' > .SRCINFO | |
| git add PKGBUILD .SRCINFO | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Update to v${PKGVER}" | |
| git push | |
| fi |