Skip to content

Commit 02fbd1d

Browse files
committed
Do the aur release ourselves
1 parent 85e816b commit 02fbd1d

1 file changed

Lines changed: 37 additions & 12 deletions

File tree

.github/workflows/aur.yml

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818
- name: Extract version
1919
id: version
2020
run: |
21-
# workflow_run sets head_branch to the tag name (e.g. "v1.2.3")
2221
TAG="${{ github.event.workflow_run.head_branch }}"
2322
echo "pkgver=${TAG#v}" >> "$GITHUB_OUTPUT"
2423
@@ -27,7 +26,6 @@ jobs:
2726
PKGVER: ${{ steps.version.outputs.pkgver }}
2827
REPO: ${{ github.repository }}
2928
run: |
30-
# Download the source tarball and compute its checksum
3129
SOURCE_URL="https://github.com/${REPO}/archive/refs/tags/v${PKGVER}.tar.gz"
3230
SHA256=$(curl -sL "$SOURCE_URL" | sha256sum | cut -d' ' -f1)
3331
@@ -61,20 +59,47 @@ jobs:
6159
}
6260
HEREDOC
6361
64-
# Remove leading whitespace from heredoc
6562
sed -i 's/^ //' PKGBUILD
66-
# Replace placeholders with actual values
6763
sed -i "s|PKGVER_PLACEHOLDER|${PKGVER}|" PKGBUILD
6864
sed -i "s|SHA256_PLACEHOLDER|${SHA256}|" PKGBUILD
6965
7066
cat PKGBUILD
7167
7268
- 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

Comments
 (0)