Skip to content

Commit 2adb7b1

Browse files
docs(release): AUR pkgver is now derived from __version__ by CI
1 parent e2d03f5 commit 2adb7b1

2 files changed

Lines changed: 14 additions & 20 deletions

File tree

CLAUDE.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Three GitHub Actions workflows live in `.github/workflows/`:
129129

130130
## Releases
131131

132-
The flow is **tag-driven**. Pushing a `vX.Y.Z` tag triggers `publish.yml`, which handles PyPI + the GitHub Release end-to-end. AUR is still updated by hand afterward.
132+
The flow is **tag-driven**. Pushing a `vX.Y.Z` tag triggers `publish.yml`, which handles PyPI + the GitHub Release end-to-end; `aur-publish.yml` then pushes to AUR automatically, deriving `pkgver` from `__version__` (never hand-bump `pkgver=` in `aur/PKGBUILD` — CI overwrites it).
133133

134134
### One-time setup (already done)
135135

@@ -156,20 +156,11 @@ GitHub Environments `pypi` and `testpypi` exist in repo settings. No API tokens
156156

157157
Trigger `Publish` manually from the Actions tab → `Run workflow` → target `testpypi`. Builds + uploads to https://test.pypi.org/project/ytm-player/ without touching production. Useful when changing build config or pyproject metadata.
158158

159-
### After PyPI publishes — update AUR
159+
### AUR (automated)
160160

161-
AUR (`ytm-player-git`) PKGBUILD lives in `aur/PKGBUILD`. After every release:
161+
`aur-publish.yml` runs after `Publish` succeeds: it checks out the release commit, derives the version from `__version__`, rewrites `pkgver=` in the copied `aur/PKGBUILD` (the committed value is only a placeholder), regenerates `.SRCINFO`, and pushes to AUR. No manual version step.
162162

163-
1. If dependencies changed: update `depends`/`optdepends`/`makedepends` in `aur/PKGBUILD`.
164-
2. Push the AUR update:
165-
166-
```bash
167-
git clone ssh://aur@aur.archlinux.org/ytm-player-git.git /tmp/ytm-player-aur
168-
cp aur/PKGBUILD /tmp/ytm-player-aur/
169-
cd /tmp/ytm-player-aur && makepkg --printsrcinfo > .SRCINFO
170-
git add PKGBUILD .SRCINFO && git commit -m "Update to vX.Y.Z" && git push
171-
rm -rf /tmp/ytm-player-aur
172-
```
163+
Still manual: if dependencies changed, update `depends`/`optdepends`/`makedepends` in `aur/PKGBUILD` before tagging. Manual push fallback (if the workflow fails) is documented in `RELEASING.md`.
173164

174165
AUR package URL: https://aur.archlinux.org/packages/ytm-player-git
175166

RELEASING.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@ The release flow is **tag-driven**. Pushing a `vX.Y.Z` tag triggers PyPI publish
44

55
## Quick checklist
66

7-
1. **Bump version**`src/ytm_player/__init__.py``__version__ = "X.Y.Z"`
8-
2. **Update PKGBUILD**`aur/PKGBUILD``pkgver=X.Y.Z`
9-
3. **Fold CHANGELOG** — collapse all `### Unreleased` blocks into one `### vX.Y.Z (YYYY-MM-DD)` entry
10-
4. **Lint + test**:
7+
1. **Bump version**`src/ytm_player/__init__.py``__version__ = "X.Y.Z"` (this is the
8+
single source of truth: the tag guard checks it and the AUR workflow derives `pkgver`
9+
from it — do NOT hand-edit `pkgver=` in `aur/PKGBUILD`, CI overwrites it)
10+
2. **Fold CHANGELOG** — collapse all `### Unreleased` blocks into one `### vX.Y.Z (YYYY-MM-DD)` entry
11+
3. **Lint + test**:
1112
```bash
1213
.venv/bin/ruff format src/ tests/
1314
.venv/bin/ruff check src/ tests/
1415
.venv/bin/pytest -x -q
1516
```
16-
5. **Commit + tag + push**:
17+
4. **Commit + tag + push**:
1718
```bash
1819
git add -A
1920
git commit -m "chore(release): vX.Y.Z"
2021
git tag vX.Y.Z
2122
git push origin master --tags
2223
```
23-
6. **Watch the workflows**:
24+
5. **Watch the workflows**:
2425
```bash
2526
gh run watch --exit-status
2627
```
@@ -35,7 +36,7 @@ No API tokens — auth is via OIDC trusted-publisher entries at PyPI and TestPyP
3536

3637
### `Publish AUR` workflow (`.github/workflows/aur-publish.yml`)
3738

38-
Triggered after `Publish` succeeds. Reads `pkgver` from `aur/PKGBUILD`, clones `ssh://aur@aur.archlinux.org/ytm-player-git.git` via SSH key, copies `PKGBUILD`, regenerates `.SRCINFO` via `scripts/regenerate_srcinfo.py` (pure Python — no Arch dependency on Ubuntu CI runners), commits and pushes.
39+
Triggered after `Publish` succeeds. Checks out the exact commit the `Publish` run built (the one the tag guard verified), reads the version from `__version__` in `src/ytm_player/__init__.py`, clones `ssh://aur@aur.archlinux.org/ytm-player-git.git` via SSH key, copies `PKGBUILD`, rewrites its `pkgver=` line to the real version (the committed `pkgver=` is only a placeholder), regenerates `.SRCINFO` via `scripts/regenerate_srcinfo.py` (pure Python — no Arch dependency on Ubuntu CI runners), commits and pushes.
3940

4041
The `regenerate_srcinfo.py` script handles shell variable expansion (`${url}`, `$pkgname`) so PKGBUILD constructs like `source=("git+${url}.git")` resolve correctly in the emitted `.SRCINFO`.
4142

@@ -44,6 +45,8 @@ The `regenerate_srcinfo.py` script handles shell variable expansion (`${url}`, `
4445
```bash
4546
git clone ssh://aur@aur.archlinux.org/ytm-player-git.git /tmp/ytm-player-aur
4647
cp aur/PKGBUILD /tmp/ytm-player-aur/
48+
# The committed pkgver= is a placeholder — set the real version, like CI does:
49+
sed -i "s/^pkgver=.*/pkgver=X.Y.Z/" /tmp/ytm-player-aur/PKGBUILD
4750
python3 scripts/regenerate_srcinfo.py /tmp/ytm-player-aur/PKGBUILD /tmp/ytm-player-aur/.SRCINFO
4851
cd /tmp/ytm-player-aur
4952
git add PKGBUILD .SRCINFO

0 commit comments

Comments
 (0)