|
| 1 | +name: Publish to AUR |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ["Release"] |
| 6 | + types: [completed] |
| 7 | + |
| 8 | +jobs: |
| 9 | + aur: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + if: github.event.workflow_run.conclusion == 'success' |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v6 |
| 15 | + with: |
| 16 | + ref: ${{ github.event.workflow_run.head_branch }} |
| 17 | + |
| 18 | + - name: Extract version |
| 19 | + id: version |
| 20 | + env: |
| 21 | + TAG: ${{ github.event.workflow_run.head_branch }} |
| 22 | + run: | |
| 23 | + echo "pkgver=${TAG#v}" >> "$GITHUB_OUTPUT" |
| 24 | +
|
| 25 | + - name: Generate PKGBUILD |
| 26 | + env: |
| 27 | + PKGVER: ${{ steps.version.outputs.pkgver }} |
| 28 | + REPO: ${{ github.repository }} |
| 29 | + run: | |
| 30 | + # Download the source tarball and compute its checksum |
| 31 | + SOURCE_URL="https://github.com/${REPO}/archive/refs/tags/v${PKGVER}.tar.gz" |
| 32 | + SHA256=$(curl -sL "$SOURCE_URL" | sha256sum | cut -d' ' -f1) |
| 33 | +
|
| 34 | + cat > PKGBUILD <<'HEREDOC' |
| 35 | + # Maintainer: Bjarne Øverli <bjarne@oever.li> |
| 36 | + pkgname=aether |
| 37 | + pkgver=PKGVER_PLACEHOLDER |
| 38 | + pkgrel=1 |
| 39 | + pkgdesc='Omarchy theming application' |
| 40 | + arch=('any') |
| 41 | + url='https://github.com/bjarneo/aether' |
| 42 | + license=('MIT') |
| 43 | + depends=('gjs' 'gtk4' 'libadwaita' 'libsoup3' 'imagemagick' 'gtk4-layer-shell') |
| 44 | + optdepends=('omarchy: Theme application backend') |
| 45 | + source=("${pkgname}-${pkgver}.tar.gz::https://github.com/bjarneo/aether/archive/refs/tags/v${pkgver}.tar.gz") |
| 46 | + sha256sums=('SHA256_PLACEHOLDER') |
| 47 | +
|
| 48 | + package() { |
| 49 | + cd "${srcdir}/${pkgname}-${pkgver}" |
| 50 | +
|
| 51 | + # Install source files |
| 52 | + install -dm755 "${pkgdir}/usr/share/${pkgname}" |
| 53 | + cp -r src templates "${pkgdir}/usr/share/${pkgname}/" |
| 54 | +
|
| 55 | + # Create launcher script |
| 56 | + install -dm755 "${pkgdir}/usr/bin" |
| 57 | + cat >"${pkgdir}/usr/bin/aether" <<'LAUNCHER' |
| 58 | + #!/bin/bash |
| 59 | + cd /usr/share/aether || exit |
| 60 | +
|
| 61 | + # Preload GTK4 Layer Shell to fix linking order issue with libwayland |
| 62 | + # See: https://github.com/wmww/gtk4-layer-shell/blob/main/linking.md |
| 63 | + export LD_PRELOAD=/usr/lib/libgtk4-layer-shell.so |
| 64 | +
|
| 65 | + exec gjs -m src/main.js "$@" |
| 66 | + LAUNCHER |
| 67 | + chmod 755 "${pkgdir}/usr/bin/aether" |
| 68 | +
|
| 69 | + # Install desktop entry |
| 70 | + install -Dm644 li.oever.aether.desktop "${pkgdir}/usr/share/applications/li.oever.aether.desktop" |
| 71 | +
|
| 72 | + # Install icon |
| 73 | + install -Dm644 icon.png "${pkgdir}/usr/share/pixmaps/aether.png" |
| 74 | +
|
| 75 | + # Install license |
| 76 | + install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md" |
| 77 | + } |
| 78 | + HEREDOC |
| 79 | +
|
| 80 | + # Remove leading whitespace from heredoc |
| 81 | + sed -i 's/^ //' PKGBUILD |
| 82 | + # Replace placeholders with actual values |
| 83 | + sed -i "s|PKGVER_PLACEHOLDER|${PKGVER}|" PKGBUILD |
| 84 | + sed -i "s|SHA256_PLACEHOLDER|${SHA256}|" PKGBUILD |
| 85 | +
|
| 86 | + cat PKGBUILD |
| 87 | +
|
| 88 | + - name: Publish to AUR |
| 89 | + uses: KSXGitHub/github-actions-deploy-aur@v4.1.1 |
| 90 | + with: |
| 91 | + pkgname: aether |
| 92 | + pkgbuild: ./PKGBUILD |
| 93 | + commit_username: ${{ secrets.AUR_USERNAME }} |
| 94 | + commit_email: ${{ secrets.AUR_EMAIL }} |
| 95 | + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} |
| 96 | + commit_message: "Update to v${{ steps.version.outputs.pkgver }}" |
0 commit comments