Skip to content

Commit ba33082

Browse files
sovanesyanclaude
andcommitted
Automate AUR publishing in release workflow
Adds .github/scripts/update-aur.sh to push PKGBUILD and .SRCINFO to both AUR repos (calendarchy, calendarchy-bin) automatically. Requires AUR_SSH_KEY secret. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1ca2459 commit ba33082

3 files changed

Lines changed: 140 additions & 17 deletions

File tree

.github/scripts/update-aur.sh

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
VERSION="$1"
5+
SOURCE_SHA="$2"
6+
LINUX_SHA="$3"
7+
8+
# --- AUR source package (calendarchy) ---
9+
git clone ssh://aur@aur.archlinux.org/calendarchy.git /tmp/aur-source
10+
11+
cat > /tmp/aur-source/PKGBUILD << EOF
12+
# Maintainer: Serge Ovanesyan
13+
pkgname=calendarchy
14+
pkgver=${VERSION}
15+
pkgrel=1
16+
pkgdesc='Terminal calendar app for Google Calendar and iCloud'
17+
arch=('x86_64')
18+
url='https://github.com/sovanesyan/calendarchy'
19+
license=('MIT')
20+
makedepends=('cargo')
21+
options=(!lto)
22+
source=("\$pkgname-\$pkgver.tar.gz::\$url/archive/v\$pkgver.tar.gz")
23+
sha256sums=('${SOURCE_SHA}')
24+
25+
prepare() {
26+
cd "\$pkgname-\$pkgver"
27+
export RUSTUP_TOOLCHAIN=stable
28+
cargo fetch --locked --target "\$(rustc -vV | sed -n 's/host: //p')"
29+
}
30+
31+
build() {
32+
cd "\$pkgname-\$pkgver"
33+
export RUSTUP_TOOLCHAIN=stable
34+
export CARGO_TARGET_DIR=target
35+
cargo build --frozen --release
36+
}
37+
38+
package() {
39+
cd "\$pkgname-\$pkgver"
40+
install -Dm755 "target/release/\$pkgname" "\$pkgdir/usr/bin/\$pkgname"
41+
install -Dm644 LICENSE "\$pkgdir/usr/share/licenses/\$pkgname/LICENSE"
42+
}
43+
EOF
44+
45+
cat > /tmp/aur-source/.SRCINFO << EOF
46+
pkgbase = calendarchy
47+
pkgdesc = Terminal calendar app for Google Calendar and iCloud
48+
pkgver = ${VERSION}
49+
pkgrel = 1
50+
url = https://github.com/sovanesyan/calendarchy
51+
arch = x86_64
52+
license = MIT
53+
makedepends = cargo
54+
options = !lto
55+
source = calendarchy-${VERSION}.tar.gz::https://github.com/sovanesyan/calendarchy/archive/v${VERSION}.tar.gz
56+
sha256sums = ${SOURCE_SHA}
57+
58+
pkgname = calendarchy
59+
EOF
60+
61+
cd /tmp/aur-source
62+
git add PKGBUILD .SRCINFO
63+
git commit -m "Update to v${VERSION}" || true
64+
git push
65+
66+
# --- AUR binary package (calendarchy-bin) ---
67+
git clone ssh://aur@aur.archlinux.org/calendarchy-bin.git /tmp/aur-bin
68+
69+
cat > /tmp/aur-bin/PKGBUILD << EOF
70+
# Maintainer: Serge Ovanesyan
71+
pkgname=calendarchy-bin
72+
pkgver=${VERSION}
73+
pkgrel=1
74+
pkgdesc='Terminal calendar app for Google Calendar and iCloud'
75+
arch=('x86_64')
76+
url='https://github.com/sovanesyan/calendarchy'
77+
license=('MIT')
78+
provides=('calendarchy')
79+
conflicts=('calendarchy')
80+
source=("\$pkgname-\$pkgver.tar.gz::\$url/releases/download/v\$pkgver/calendarchy-x86_64-unknown-linux-gnu.tar.gz")
81+
sha256sums=('${LINUX_SHA}')
82+
83+
package() {
84+
install -Dm755 calendarchy "\$pkgdir/usr/bin/calendarchy"
85+
install -Dm644 LICENSE "\$pkgdir/usr/share/licenses/\$pkgname/LICENSE"
86+
}
87+
EOF
88+
89+
cat > /tmp/aur-bin/.SRCINFO << EOF
90+
pkgbase = calendarchy-bin
91+
pkgdesc = Terminal calendar app for Google Calendar and iCloud
92+
pkgver = ${VERSION}
93+
pkgrel = 1
94+
url = https://github.com/sovanesyan/calendarchy
95+
arch = x86_64
96+
license = MIT
97+
provides = calendarchy
98+
conflicts = calendarchy
99+
source = calendarchy-bin-${VERSION}.tar.gz::https://github.com/sovanesyan/calendarchy/releases/download/v${VERSION}/calendarchy-x86_64-unknown-linux-gnu.tar.gz
100+
sha256sums = ${LINUX_SHA}
101+
102+
pkgname = calendarchy-bin
103+
EOF
104+
105+
cd /tmp/aur-bin
106+
git add PKGBUILD .SRCINFO
107+
git commit -m "Update to v${VERSION}" || true
108+
git push

.github/workflows/release.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
echo "arm64_sha256=$(sha256sum calendarchy-aarch64-apple-darwin.tar.gz | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
7676
echo "x86_64_sha256=$(sha256sum calendarchy-x86_64-apple-darwin.tar.gz | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
7777
echo "linux_x86_64_sha256=$(sha256sum calendarchy-x86_64-unknown-linux-gnu.tar.gz | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
78+
echo "source_sha256=$(curl -sL "https://github.com/sovanesyan/calendarchy/archive/${GITHUB_REF_NAME}.tar.gz" | sha256sum | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
7879
7980
- name: Create GitHub Release
8081
uses: softprops/action-gh-release@v2
@@ -122,7 +123,6 @@ jobs:
122123
end
123124
FORMULA
124125
125-
# Clone tap repo, update formula, push
126126
git clone "https://x-access-token:${TAP_TOKEN}@github.com/sovanesyan/homebrew-calendarchy.git" /tmp/tap
127127
mkdir -p /tmp/tap/Formula
128128
cp /tmp/calendarchy.rb /tmp/tap/Formula/calendarchy.rb
@@ -132,3 +132,22 @@ jobs:
132132
git add Formula/calendarchy.rb
133133
git commit -m "Update calendarchy to ${VERSION}" || exit 0
134134
git push
135+
136+
- name: Update AUR packages
137+
env:
138+
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
139+
run: |
140+
VERSION="${GITHUB_REF_NAME#v}"
141+
SOURCE_SHA="${{ steps.hashes.outputs.source_sha256 }}"
142+
LINUX_SHA="${{ steps.hashes.outputs.linux_x86_64_sha256 }}"
143+
144+
mkdir -p ~/.ssh
145+
echo "$AUR_SSH_KEY" > ~/.ssh/aur
146+
chmod 600 ~/.ssh/aur
147+
printf 'Host aur.archlinux.org\n IdentityFile ~/.ssh/aur\n User aur\n' > ~/.ssh/config
148+
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null
149+
150+
git config --global user.name "Serge Ovanesyan"
151+
git config --global user.email "sovanesyan@users.noreply.github.com"
152+
153+
.github/scripts/update-aur.sh "$VERSION" "$SOURCE_SHA" "$LINUX_SHA"

CLAUDE.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,23 @@ UI ← EventCache.get(date) ←────────────────
5454

5555
## Release Process
5656

57-
To release a new version (e.g., 0.1.3 -> 0.1.4):
57+
To release a new version (e.g., 0.1.5 -> 0.1.6):
5858

59-
1. **Bump version** in `Cargo.toml`, `pkg/arch/PKGBUILD`, `pkg/arch-bin/PKGBUILD` (set sha256sums to SKIP temporarily)
59+
1. **Bump version** in `Cargo.toml`
6060
2. **Commit and push** to master
61-
3. **Tag and push**: `git tag v0.1.4 && git push origin v0.1.4`
62-
4. **Wait for GitHub Actions** (`.github/workflows/release.yml`) — it builds macOS ARM/Intel + Linux binaries, creates the GitHub Release, and updates the Homebrew tap automatically
63-
5. **Compute sha256sums** from released artifacts:
64-
- Source: `curl -sL "https://github.com/sovanesyan/calendarchy/archive/v0.1.4.tar.gz" | sha256sum`
65-
- Linux binary: `curl -sL "https://github.com/sovanesyan/calendarchy/releases/download/v0.1.4/calendarchy-x86_64-unknown-linux-gnu.tar.gz" | sha256sum`
66-
6. **Update PKGBUILDs** with real sha256sums, commit and push to master
67-
7. **Update AUR packages** (two separate repos, push manually):
68-
- `git clone ssh://aur@aur.archlinux.org/calendarchy-bin.git` — copy from `pkg/arch-bin/PKGBUILD`
69-
- `git clone ssh://aur@aur.archlinux.org/calendarchy.git` — copy from `pkg/arch/PKGBUILD`
70-
- Generate `.SRCINFO`: `makepkg --printsrcinfo > .SRCINFO`
71-
- Commit and push each
61+
3. **Tag and push**: `git tag v0.1.6 && git push origin v0.1.6`
62+
4. **Done** — GitHub Actions handles everything:
63+
- Builds macOS ARM/Intel + Linux binaries
64+
- Creates the GitHub Release
65+
- Updates the Homebrew tap (`HOMEBREW_TAP_TOKEN` secret)
66+
- Updates both AUR packages (`AUR_SSH_KEY` secret)
7267

7368
### Package Locations
7469

75-
- **Homebrew**: `sovanesyan/homebrew-calendarchy` (auto-updated by release workflow via `HOMEBREW_TAP_TOKEN` secret)
76-
- **AUR binary**: `ssh://aur@aur.archlinux.org/calendarchy-bin.git`
77-
- **AUR source**: `ssh://aur@aur.archlinux.org/calendarchy.git`
70+
- **Homebrew**: `sovanesyan/homebrew-calendarchy` (auto-updated by workflow)
71+
- **AUR binary**: `ssh://aur@aur.archlinux.org/calendarchy-bin.git` (auto-updated by workflow)
72+
- **AUR source**: `ssh://aur@aur.archlinux.org/calendarchy.git` (auto-updated by workflow)
73+
- **Local PKGBUILDs**: `pkg/arch/` and `pkg/arch-bin/` are reference copies (workflow generates its own)
7874

7975
### Website
8076

0 commit comments

Comments
 (0)