|
18 | 18 | - name: Extract version |
19 | 19 | id: version |
20 | 20 | run: | |
21 | | - # workflow_run sets head_branch to the tag name (e.g. "v1.2.3") |
22 | 21 | TAG="${{ github.event.workflow_run.head_branch }}" |
23 | 22 | echo "pkgver=${TAG#v}" >> "$GITHUB_OUTPUT" |
24 | 23 |
|
|
27 | 26 | PKGVER: ${{ steps.version.outputs.pkgver }} |
28 | 27 | REPO: ${{ github.repository }} |
29 | 28 | run: | |
30 | | - # Download the source tarball and compute its checksum |
31 | 29 | SOURCE_URL="https://github.com/${REPO}/archive/refs/tags/v${PKGVER}.tar.gz" |
32 | 30 | SHA256=$(curl -sL "$SOURCE_URL" | sha256sum | cut -d' ' -f1) |
33 | 31 |
|
@@ -61,20 +59,47 @@ jobs: |
61 | 59 | } |
62 | 60 | HEREDOC |
63 | 61 |
|
64 | | - # Remove leading whitespace from heredoc |
65 | 62 | sed -i 's/^ //' PKGBUILD |
66 | | - # Replace placeholders with actual values |
67 | 63 | sed -i "s|PKGVER_PLACEHOLDER|${PKGVER}|" PKGBUILD |
68 | 64 | sed -i "s|SHA256_PLACEHOLDER|${SHA256}|" PKGBUILD |
69 | 65 |
|
70 | 66 | cat PKGBUILD |
71 | 67 |
|
72 | 68 | - name: Publish to AUR |
73 | | - uses: KSXGitHub/github-actions-deploy-aur@v4.1.1 |
74 | | - with: |
75 | | - pkgname: cliamp |
76 | | - pkgbuild: ./PKGBUILD |
77 | | - commit_username: ${{ secrets.AUR_USERNAME }} |
78 | | - commit_email: ${{ secrets.AUR_EMAIL }} |
79 | | - ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} |
80 | | - commit_message: "Update to v${{ steps.version.outputs.pkgver }}" |
| 69 | + env: |
| 70 | + AUR_SSH_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }} |
| 71 | + AUR_USERNAME: ${{ secrets.AUR_USERNAME }} |
| 72 | + AUR_EMAIL: ${{ secrets.AUR_EMAIL }} |
| 73 | + PKGVER: ${{ steps.version.outputs.pkgver }} |
| 74 | + run: | |
| 75 | + # Setup SSH |
| 76 | + mkdir -p ~/.ssh |
| 77 | + echo "$AUR_SSH_KEY" > ~/.ssh/aur |
| 78 | + chmod 600 ~/.ssh/aur |
| 79 | + ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null |
| 80 | + cat >> ~/.ssh/config <<EOF |
| 81 | + Host aur.archlinux.org |
| 82 | + IdentityFile ~/.ssh/aur |
| 83 | + User aur |
| 84 | + EOF |
| 85 | +
|
| 86 | + # Clone AUR repo |
| 87 | + git clone ssh://aur@aur.archlinux.org/cliamp.git aur-repo |
| 88 | + cd aur-repo |
| 89 | +
|
| 90 | + git config user.name "$AUR_USERNAME" |
| 91 | + git config user.email "$AUR_EMAIL" |
| 92 | +
|
| 93 | + # Copy PKGBUILD and generate .SRCINFO |
| 94 | + cp ../PKGBUILD . |
| 95 | + docker run --rm -v "$PWD:/pkg" archlinux:base bash -c \ |
| 96 | + 'pacman -Sy --noconfirm pacman-contrib && chown -R nobody /pkg && cd /pkg && sudo -u nobody makepkg --printsrcinfo > .SRCINFO' |
| 97 | +
|
| 98 | + # Commit and push |
| 99 | + git add PKGBUILD .SRCINFO |
| 100 | + if git diff --cached --quiet; then |
| 101 | + echo "No changes to commit" |
| 102 | + else |
| 103 | + git commit -m "Update to v${PKGVER}" |
| 104 | + git push |
| 105 | + fi |
0 commit comments