swadhinbiswas fix(ci): use dynamic GITHUB_WORKSPACE in AUR publishing workflow · 8/17/2026
6b95620
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build-release:
name: Build & Publish GitHub Release
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
- name: Run Tests
run: go test -v ./...
- name: Compile Multi-Architecture Binaries
env:
TAG_NAME: ${{ github.ref_name }}
run: |
mkdir -p dist
# Linux amd64 (x86_64)
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${TAG_NAME}" -o dist/veet-linux-amd64 .
tar -czf dist/veet-${TAG_NAME}-linux-amd64.tar.gz -C dist veet-linux-amd64
# Linux arm64 (aarch64)
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${TAG_NAME}" -o dist/veet-linux-arm64 .
tar -czf dist/veet-${TAG_NAME}-linux-arm64.tar.gz -C dist veet-linux-arm64
# Linux armv7
GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${TAG_NAME}" -o dist/veet-linux-armv7 .
tar -czf dist/veet-${TAG_NAME}-linux-armv7.tar.gz -C dist veet-linux-armv7
# SHA256 Checksums
cd dist
sha256sum *.tar.gz > checksums.txt
cat checksums.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
dist/checksums.txt
generate_release_notes: true
- name: Register on Go Package Proxy (pkg.go.dev)
env:
TAG_NAME: ${{ github.ref_name }}
run: |
curl -s "https://proxy.golang.org/github.com/swadhinbiswas/veet/@v/${TAG_NAME}.info" || true
publish-aur:
name: Publish to Arch User Repository (AUR)
needs: build-release
runs-on: ubuntu-latest
container:
image: archlinux:base-devel
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Git & OpenSSH
run: |
pacman -Syu --noconfirm git openssh curl
- name: Generate Updated PKGBUILD & .SRCINFO
run: |
set -e
TAG="${GITHUB_REF_NAME}"
VERSION="${TAG#v}"
# Fetch release source tarball and compute SHA256
curl -sL "https://github.com/${{ github.repository }}/archive/refs/tags/${TAG}.tar.gz" -o /tmp/source.tar.gz
CHECKSUM=$(sha256sum /tmp/source.tar.gz | awk '{print $1}')
# 1. Update veet (stable release)
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" aur/veet/PKGBUILD
sed -i "s/^pkgrel=.*/pkgrel=1/" aur/veet/PKGBUILD
sed -i "s/^sha256sums=.*/sha256sums=('${CHECKSUM}')/" aur/veet/PKGBUILD
# 2. Update veet-git
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" aur/veet-git/PKGBUILD
sed -i "s/^pkgrel=.*/pkgrel=1/" aur/veet-git/PKGBUILD
# makepkg requires a non-root user
useradd -m builduser 2>/dev/null || true
chown -R builduser:builduser "${GITHUB_WORKSPACE:-.}"
# Generate .SRCINFO
su builduser -c "cd '${GITHUB_WORKSPACE:-.}/aur/veet' && makepkg --printsrcinfo" > aur/veet/.SRCINFO
su builduser -c "cd '${GITHUB_WORKSPACE:-.}/aur/veet-git' && makepkg --printsrcinfo" > aur/veet-git/.SRCINFO
- name: Deploy to AUR
env:
AUR_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
run: |
if [ -z "$AUR_KEY" ]; then
echo "::warning ::AUR_SSH_PRIVATE_KEY secret is not set in GitHub Secrets. Skipping AUR automated push."
exit 0
fi
mkdir -p ~/.ssh
echo "$AUR_KEY" > ~/.ssh/aur_key
chmod 600 ~/.ssh/aur_key
ssh-keyscan -t ed25519,rsa aur.archlinux.org >> ~/.ssh/known_hosts
git config --global user.name "Swadhin Biswas"
git config --global user.email "[email protected]"
# Deploy veet (stable release package)
if GIT_SSH_COMMAND="ssh -i ~/.ssh/aur_key -o StrictHostKeyChecking=accept-new" git clone ssh://[email protected]/veet.git /tmp/aur-veet; then
cp aur/veet/PKGBUILD aur/veet/.SRCINFO /tmp/aur-veet/
cd /tmp/aur-veet
git add PKGBUILD .SRCINFO
if git diff --staged --quiet; then
echo "No changes to deploy to AUR (veet)."
else
git commit -m "chore(release): update to ${GITHUB_REF_NAME}"
GIT_SSH_COMMAND="ssh -i ~/.ssh/aur_key -o StrictHostKeyChecking=accept-new" git push origin master
echo "Successfully published ${GITHUB_REF_NAME} to AUR (veet)!"
fi
cd "${GITHUB_WORKSPACE:-$OLDPWD}"
fi
# Deploy veet-git (VCS package)
if GIT_SSH_COMMAND="ssh -i ~/.ssh/aur_key -o StrictHostKeyChecking=accept-new" git clone ssh://[email protected]/veet-git.git /tmp/aur-veet-git; then
cp aur/veet-git/PKGBUILD aur/veet-git/.SRCINFO /tmp/aur-veet-git/
cd /tmp/aur-veet-git
git add PKGBUILD .SRCINFO
if git diff --staged --quiet; then
echo "No changes to deploy to AUR (veet-git)."
else
git commit -m "chore(release): update to ${GITHUB_REF_NAME}"
GIT_SSH_COMMAND="ssh -i ~/.ssh/aur_key -o StrictHostKeyChecking=accept-new" git push origin master
echo "Successfully published ${GITHUB_REF_NAME} to AUR (veet-git)!"
fi
cd "${GITHUB_WORKSPACE:-$OLDPWD}"
fi