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 |
scripts/aur-ssh-setup.sh | Install SSH key from GitLab File or base64 variable |
scripts/bootstrap-aur-repo.sh | One-time initial push to create the AUR repo |
.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
GitLab masked variables cannot contain spaces or newlines. An OpenSSH private key is multiline, so do not paste the raw private key into a masked variable.
Use one of these:
Option A — File variable (simplest)
| Variable | Type | Value |
|---|---|---|
AUR_SSH_PRIVATE_KEY | File | Paste the full private key file (including BEGIN / END lines) |
AUR_GIT_AUTHOR_NAME | Variable | Your name |
AUR_GIT_AUTHOR_EMAIL | Variable | Your email |
AUR_PKGBASE | Variable (optional) | Defaults to posprint |
Mark AUR_SSH_PRIVATE_KEY as Protected. File variables cannot be masked; that is normal for SSH keys.
Option B — Base64 (maskable)
On your machine, encode the private key as one line (no spaces):
# Linux
base64 -w0 ~/.ssh/id_ed25519
# macOS
base64 -i ~/.ssh/id_ed25519 | tr -d '\n'
# PowerShell (Windows)
[Convert]::ToBase64String([IO.File]::ReadAllBytes("$env:USERPROFILE\.ssh\id_ed25519"))
Store the output in GitLab as:
| Variable | Notes |
|---|---|
AUR_SSH_PRIVATE_KEY_B64 | The single-line base64 string; can be Masked + Protected |
CI decodes it via scripts/aur-ssh-setup.sh.
Public vs private key
What you add on aur.archlinux.org under SSH keys is the public key (one line starting with ssh-ed25519 AAAA...). Never paste the private key (-----BEGIN OPENSSH PRIVATE KEY-----) in chat, GitLab logs, or the repo.
Recommended:
- mark release variables as Protected
- run tag pipelines only on protected tags
How to create the AUR repository
If you have an AUR account but no package yet:
1. Add your SSH public key (one line, ssh-ed25519 AAAA...) on aur.archlinux.org → Account → SSH keys. That is not the private key file from ~/.ssh/id_ed25519. 2. On a machine where ssh -T aur@aur.archlinux.org works, from this repo:
chmod +x scripts/bootstrap-aur-repo.sh scripts/aur-ssh-setup.sh
./scripts/bootstrap-aur-repo.sh
This copies packaging/aur/PKGBUILD and .SRCINFO, commits, and pushes to ssh://aur@aur.archlinux.org/posprint.git.
Manual equivalent:
mkdir ~/posprint-aur && cd ~/posprint-aur
git init
git remote add origin ssh://aur@aur.archlinux.org/posprint.git
git checkout -b master
cp /path/to/posprint/packaging/aur/PKGBUILD .
cp /path/to/posprint/packaging/aur/.SRCINFO .
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 | | `scripts/aur-ssh-setup.sh` | Install SSH key from GitLab File or base64 variable | |
| 28 | | `scripts/bootstrap-aur-repo.sh` | One-time initial push to create the AUR repo | |
| 29 | | `.gitlab-ci.yml` | Runs AUR publish on tags | |
| 30 | |
| 31 | ## Release flow |
| 32 | |
| 33 | When a Git tag is pushed: |
| 34 | |
| 35 | 1. GitLab builds the normal release artifacts. |
| 36 | 2. GitLab creates the upstream release. |
| 37 | 3. GitLab runs `scripts/publish-aur.sh "$CI_COMMIT_TAG"`. |
| 38 | 4. The script: |
| 39 | - downloads the tagged source tarball |
| 40 | - computes its SHA-256 |
| 41 | - clones the AUR repo |
| 42 | - updates `pkgver`, `pkgrel`, and `sha256sums` |
| 43 | - regenerates `.SRCINFO` |
| 44 | - commits and pushes to AUR `master` |
| 45 | |
| 46 | ## GitLab CI secrets |
| 47 | |
| 48 | GitLab **masked** variables cannot contain spaces or newlines. An OpenSSH private key is multiline, so do **not** paste the raw private key into a masked variable. |
| 49 | |
| 50 | Use **one** of these: |
| 51 | |
| 52 | ### Option A — File variable (simplest) |
| 53 | |
| 54 | | Variable | Type | Value | |
| 55 | |----------|------|--------| |
| 56 | | `AUR_SSH_PRIVATE_KEY` | **File** | Paste the full private key file (including `BEGIN` / `END` lines) | |
| 57 | | `AUR_GIT_AUTHOR_NAME` | Variable | Your name | |
| 58 | | `AUR_GIT_AUTHOR_EMAIL` | Variable | Your email | |
| 59 | | `AUR_PKGBASE` | Variable (optional) | Defaults to `posprint` | |
| 60 | |
| 61 | Mark `AUR_SSH_PRIVATE_KEY` as **Protected**. File variables cannot be masked; that is normal for SSH keys. |
| 62 | |
| 63 | ### Option B — Base64 (maskable) |
| 64 | |
| 65 | On your machine, encode the private key as **one line** (no spaces): |
| 66 | |
| 67 | ```bash |
| 68 | # Linux |
| 69 | base64 -w0 ~/.ssh/id_ed25519 |
| 70 | |
| 71 | # macOS |
| 72 | base64 -i ~/.ssh/id_ed25519 | tr -d '\n' |
| 73 | |
| 74 | # PowerShell (Windows) |
| 75 | [Convert]::ToBase64String([IO.File]::ReadAllBytes("$env:USERPROFILE\.ssh\id_ed25519")) |
| 76 | ``` |
| 77 | |
| 78 | Store the output in GitLab as: |
| 79 | |
| 80 | | Variable | Notes | |
| 81 | |----------|--------| |
| 82 | | `AUR_SSH_PRIVATE_KEY_B64` | The single-line base64 string; can be **Masked** + **Protected** | |
| 83 | |
| 84 | CI decodes it via `scripts/aur-ssh-setup.sh`. |
| 85 | |
| 86 | ### Public vs private key |
| 87 | |
| 88 | What you add on [aur.archlinux.org](https://aur.archlinux.org) under **SSH keys** is the **public** key (one line starting with `ssh-ed25519 AAAA...`). |
| 89 | Never paste the **private** key (`-----BEGIN OPENSSH PRIVATE KEY-----`) in chat, GitLab logs, or the repo. |
| 90 | |
| 91 | Recommended: |
| 92 | |
| 93 | - mark release variables as **Protected** |
| 94 | - run tag pipelines only on **protected tags** |
| 95 | |
| 96 | ## How to create the AUR repository |
| 97 | |
| 98 | If you have an AUR account but no package yet: |
| 99 | |
| 100 | 1. Add your **SSH public key** (one line, `ssh-ed25519 AAAA...`) on [aur.archlinux.org](https://aur.archlinux.org) → Account → SSH keys. |
| 101 | That is **not** the private key file from `~/.ssh/id_ed25519`. |
| 102 | 2. On a machine where `ssh -T aur@aur.archlinux.org` works, from this repo: |
| 103 | |
| 104 | ```bash |
| 105 | chmod +x scripts/bootstrap-aur-repo.sh scripts/aur-ssh-setup.sh |
| 106 | ./scripts/bootstrap-aur-repo.sh |
| 107 | ``` |
| 108 | |
| 109 | This copies `packaging/aur/PKGBUILD` and `.SRCINFO`, commits, and pushes to `ssh://aur@aur.archlinux.org/posprint.git`. |
| 110 | |
| 111 | Manual equivalent: |
| 112 | |
| 113 | ```bash |
| 114 | mkdir ~/posprint-aur && cd ~/posprint-aur |
| 115 | git init |
| 116 | git remote add origin ssh://aur@aur.archlinux.org/posprint.git |
| 117 | git checkout -b master |
| 118 | cp /path/to/posprint/packaging/aur/PKGBUILD . |
| 119 | cp /path/to/posprint/packaging/aur/.SRCINFO . |
| 120 | git add PKGBUILD .SRCINFO |
| 121 | git commit -m "initial import" |
| 122 | git push origin master |
| 123 | ``` |
| 124 | |
| 125 | After the first push, the AUR package page exists and later tag pipelines can update it. |
| 126 | |
| 127 | ## Bootstrapping manually |
| 128 | |
| 129 | Before enabling CI automation, test one update locally: |
| 130 | |
| 131 | ```bash |
| 132 | cd /path/to/posprint |
| 133 | ./scripts/publish-aur.sh 0.4.0 |
| 134 | ``` |
| 135 | |
| 136 | Requirements on that machine: |
| 137 | |
| 138 | - `git` |
| 139 | - `curl` |
| 140 | - `sha256sum` |
| 141 | - `makepkg` |
| 142 | - SSH access to `aur@aur.archlinux.org` |
| 143 | |
| 144 | ## Notes |
| 145 | |
| 146 | - `pkgrel` resets to `1` for every new upstream release. |
| 147 | - If you need an AUR-only packaging fix without a new upstream release, bump `pkgrel` in the AUR repo manually. |
| 148 | - `.SRCINFO` must always be committed together with `PKGBUILD`. |
| 149 | - The AUR only accepts pushes to the `master` branch. |