AUR publishing
How posprint is published to the Arch User Repository (AUR) from GitLab tags.
Chosen approach
This repository keeps two Arch package definitions:
packaging/arch/PKGBUILD: local builds and GitLab artifact builds (.pkg.tar.zst)packaging/aur/PKGBUILD: AUR source package, built by the AUR user from the GitLab tag tarball
The AUR package is not -bin. It downloads:
https://gitlab.com/Timfa/posprint/-/archive/<version>/posprint-<version>.tar.gz
That keeps the AUR package simple, reproducible, and aligned with upstream tags.
Files in this repo
| Path | Purpose |
|---|---|
packaging/aur/PKGBUILD | AUR package template |
packaging/aur/.SRCINFO | Initial generated metadata |
scripts/publish-aur.sh | Clone AUR repo, update PKGBUILD/.SRCINFO, commit, push |
.gitlab-ci.yml | Runs AUR publish on tags |
Release flow
When a Git tag is pushed:
1. GitLab builds the normal release artifacts. 2. GitLab creates the upstream release. 3. GitLab runs scripts/publish-aur.sh "$CI_COMMIT_TAG". 4. The script:
- downloads the tagged source tarball
- computes its SHA-256
- clones the AUR repo
- updates
pkgver,pkgrel, andsha256sums - regenerates
.SRCINFO - commits and pushes to AUR
master
GitLab CI secrets
Create these CI/CD variables in GitLab:
| Variable | Required | Notes |
|---|---|---|
AUR_SSH_PRIVATE_KEY | yes | Private SSH key for your AUR account; use masked + protected |
AUR_GIT_AUTHOR_NAME | recommended | Example: Tim Falken or posprint release bot |
AUR_GIT_AUTHOR_EMAIL | recommended | Example: you@example.com |
AUR_PKGBASE | optional | Defaults to posprint; only needed if the AUR repo name differs |
Recommended GitLab settings:
- mark the variables as Protected
- mark
AUR_SSH_PRIVATE_KEYas Masked - only allow the release/tag pipeline on protected tags
How to create the AUR repository
If you have an AUR account but no package yet:
1. Make sure your SSH public key is added to your AUR account profile. 2. On an Arch machine (or any machine with git + makepkg), create a working directory:
mkdir ~/posprint-aur
cd ~/posprint-aur
git init
git remote add origin ssh://aur@aur.archlinux.org/posprint.git
3. Copy in the initial metadata from this repo:
cp /path/to/posprint/packaging/aur/PKGBUILD .
cp /path/to/posprint/packaging/aur/.SRCINFO .
4. Commit and push:
git checkout -b master
git add PKGBUILD .SRCINFO
git commit -m "initial import"
git push origin master
After the first push, the AUR package page exists and later tag pipelines can update it.
Bootstrapping manually
Before enabling CI automation, test one update locally:
cd /path/to/posprint
./scripts/publish-aur.sh 0.4.0
Requirements on that machine:
gitcurlsha256summakepkg- SSH access to
aur@aur.archlinux.org
Notes
pkgrelresets to1for every new upstream release.- If you need an AUR-only packaging fix without a new upstream release, bump
pkgrelin the AUR repo manually. .SRCINFOmust always be committed together withPKGBUILD.- The AUR only accepts pushes to the
masterbranch.
Source
| 1 | # AUR publishing |
| 2 | |
| 3 | How `posprint` is published to the Arch User Repository (AUR) from GitLab tags. |
| 4 | |
| 5 | ## Chosen approach |
| 6 | |
| 7 | This repository keeps **two Arch package definitions**: |
| 8 | |
| 9 | - `packaging/arch/PKGBUILD`: local builds and GitLab artifact builds (`.pkg.tar.zst`) |
| 10 | - `packaging/aur/PKGBUILD`: AUR source package, built by the AUR user from the GitLab tag tarball |
| 11 | |
| 12 | The AUR package is **not** `-bin`. It downloads: |
| 13 | |
| 14 | ```text |
| 15 | https://gitlab.com/Timfa/posprint/-/archive/<version>/posprint-<version>.tar.gz |
| 16 | ``` |
| 17 | |
| 18 | That keeps the AUR package simple, reproducible, and aligned with upstream tags. |
| 19 | |
| 20 | ## Files in this repo |
| 21 | |
| 22 | | Path | Purpose | |
| 23 | |------|---------| |
| 24 | | `packaging/aur/PKGBUILD` | AUR package template | |
| 25 | | `packaging/aur/.SRCINFO` | Initial generated metadata | |
| 26 | | `scripts/publish-aur.sh` | Clone AUR repo, update `PKGBUILD`/`.SRCINFO`, commit, push | |
| 27 | | `.gitlab-ci.yml` | Runs AUR publish on tags | |
| 28 | |
| 29 | ## Release flow |
| 30 | |
| 31 | When a Git tag is pushed: |
| 32 | |
| 33 | 1. GitLab builds the normal release artifacts. |
| 34 | 2. GitLab creates the upstream release. |
| 35 | 3. GitLab runs `scripts/publish-aur.sh "$CI_COMMIT_TAG"`. |
| 36 | 4. The script: |
| 37 | - downloads the tagged source tarball |
| 38 | - computes its SHA-256 |
| 39 | - clones the AUR repo |
| 40 | - updates `pkgver`, `pkgrel`, and `sha256sums` |
| 41 | - regenerates `.SRCINFO` |
| 42 | - commits and pushes to AUR `master` |
| 43 | |
| 44 | ## GitLab CI secrets |
| 45 | |
| 46 | Create these **CI/CD variables** in GitLab: |
| 47 | |
| 48 | | Variable | Required | Notes | |
| 49 | |----------|----------|-------| |
| 50 | | `AUR_SSH_PRIVATE_KEY` | yes | Private SSH key for your AUR account; use **masked** + **protected** | |
| 51 | | `AUR_GIT_AUTHOR_NAME` | recommended | Example: `Tim Falken` or `posprint release bot` | |
| 52 | | `AUR_GIT_AUTHOR_EMAIL` | recommended | Example: `you@example.com` | |
| 53 | | `AUR_PKGBASE` | optional | Defaults to `posprint`; only needed if the AUR repo name differs | |
| 54 | |
| 55 | Recommended GitLab settings: |
| 56 | |
| 57 | - mark the variables as **Protected** |
| 58 | - mark `AUR_SSH_PRIVATE_KEY` as **Masked** |
| 59 | - only allow the release/tag pipeline on protected tags |
| 60 | |
| 61 | ## How to create the AUR repository |
| 62 | |
| 63 | If you have an AUR account but no package yet: |
| 64 | |
| 65 | 1. Make sure your **SSH public key** is added to your AUR account profile. |
| 66 | 2. On an Arch machine (or any machine with `git` + `makepkg`), create a working directory: |
| 67 | |
| 68 | ```bash |
| 69 | mkdir ~/posprint-aur |
| 70 | cd ~/posprint-aur |
| 71 | git init |
| 72 | git remote add origin ssh://aur@aur.archlinux.org/posprint.git |
| 73 | ``` |
| 74 | |
| 75 | 3. Copy in the initial metadata from this repo: |
| 76 | |
| 77 | ```bash |
| 78 | cp /path/to/posprint/packaging/aur/PKGBUILD . |
| 79 | cp /path/to/posprint/packaging/aur/.SRCINFO . |
| 80 | ``` |
| 81 | |
| 82 | 4. Commit and push: |
| 83 | |
| 84 | ```bash |
| 85 | git checkout -b master |
| 86 | git add PKGBUILD .SRCINFO |
| 87 | git commit -m "initial import" |
| 88 | git push origin master |
| 89 | ``` |
| 90 | |
| 91 | After the first push, the AUR package page exists and later tag pipelines can update it. |
| 92 | |
| 93 | ## Bootstrapping manually |
| 94 | |
| 95 | Before enabling CI automation, test one update locally: |
| 96 | |
| 97 | ```bash |
| 98 | cd /path/to/posprint |
| 99 | ./scripts/publish-aur.sh 0.4.0 |
| 100 | ``` |
| 101 | |
| 102 | Requirements on that machine: |
| 103 | |
| 104 | - `git` |
| 105 | - `curl` |
| 106 | - `sha256sum` |
| 107 | - `makepkg` |
| 108 | - SSH access to `aur@aur.archlinux.org` |
| 109 | |
| 110 | ## Notes |
| 111 | |
| 112 | - `pkgrel` resets to `1` for every new upstream release. |
| 113 | - If you need an AUR-only packaging fix without a new upstream release, bump `pkgrel` in the AUR repo manually. |
| 114 | - `.SRCINFO` must always be committed together with `PKGBUILD`. |
| 115 | - The AUR only accepts pushes to the `master` branch. |