BlueGit

timfa posprint

Files

posprint / docs / AUR.md

AUR.md

9611cde4 History
AUR.md 4.6 KiB Download Raw

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

PathPurpose
packaging/aur/PKGBUILDAUR package template
packaging/aur/.SRCINFOInitial generated metadata
scripts/publish-aur.shClone AUR repo, update PKGBUILD/.SRCINFO, commit, push
scripts/aur-ssh-setup.shInstall SSH key from GitLab File or base64 variable
scripts/bootstrap-aur-repo.shOne-time initial push to create the AUR repo
.gitlab-ci.ymlRuns 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, and sha256sums
  • 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)

VariableTypeValue
AUR_SSH_PRIVATE_KEYFilePaste the full private key file (including BEGIN / END lines)
AUR_GIT_AUTHOR_NAMEVariableYour name
AUR_GIT_AUTHOR_EMAILVariableYour email
AUR_PKGBASEVariable (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:

VariableNotes
AUR_SSH_PRIVATE_KEY_B64The 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:

  • git
  • curl
  • sha256sum
  • makepkg
  • SSH access to aur@aur.archlinux.org

Notes

  • pkgrel resets to 1 for every new upstream release.
  • If you need an AUR-only packaging fix without a new upstream release, bump pkgrel in the AUR repo manually.
  • .SRCINFO must always be committed together with PKGBUILD.
  • The AUR only accepts pushes to the master branch.
Source
1# AUR publishing
2
3How `posprint` is published to the Arch User Repository (AUR) from GitLab tags.
4
5## Chosen approach
6
7This 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
12The AUR package is **not** `-bin`. It downloads:
13
14```text
15https://gitlab.com/Timfa/posprint/-/archive/<version>/posprint-<version>.tar.gz
16```
17
18That 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
33When a Git tag is pushed:
34
351. GitLab builds the normal release artifacts.
362. GitLab creates the upstream release.
373. GitLab runs `scripts/publish-aur.sh "$CI_COMMIT_TAG"`.
384. 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
48GitLab **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
50Use **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
61Mark `AUR_SSH_PRIVATE_KEY` as **Protected**. File variables cannot be masked; that is normal for SSH keys.
62
63### Option B — Base64 (maskable)
64
65On your machine, encode the private key as **one line** (no spaces):
66
67```bash
68# Linux
69base64 -w0 ~/.ssh/id_ed25519
70
71# macOS
72base64 -i ~/.ssh/id_ed25519 | tr -d '\n'
73
74# PowerShell (Windows)
75[Convert]::ToBase64String([IO.File]::ReadAllBytes("$env:USERPROFILE\.ssh\id_ed25519"))
76```
77
78Store 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
84CI decodes it via `scripts/aur-ssh-setup.sh`.
85
86### Public vs private key
87
88What you add on [aur.archlinux.org](https://aur.archlinux.org) under **SSH keys** is the **public** key (one line starting with `ssh-ed25519 AAAA...`).
89Never paste the **private** key (`-----BEGIN OPENSSH PRIVATE KEY-----`) in chat, GitLab logs, or the repo.
90
91Recommended:
92
93- mark release variables as **Protected**
94- run tag pipelines only on **protected tags**
95
96## How to create the AUR repository
97
98If you have an AUR account but no package yet:
99
1001. 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`.
1022. On a machine where `ssh -T aur@aur.archlinux.org` works, from this repo:
103
104```bash
105chmod +x scripts/bootstrap-aur-repo.sh scripts/aur-ssh-setup.sh
106./scripts/bootstrap-aur-repo.sh
107```
108
109This copies `packaging/aur/PKGBUILD` and `.SRCINFO`, commits, and pushes to `ssh://aur@aur.archlinux.org/posprint.git`.
110
111Manual equivalent:
112
113```bash
114mkdir ~/posprint-aur && cd ~/posprint-aur
115git init
116git remote add origin ssh://aur@aur.archlinux.org/posprint.git
117git checkout -b master
118cp /path/to/posprint/packaging/aur/PKGBUILD .
119cp /path/to/posprint/packaging/aur/.SRCINFO .
120git add PKGBUILD .SRCINFO
121git commit -m "initial import"
122git push origin master
123```
124
125After the first push, the AUR package page exists and later tag pipelines can update it.
126
127## Bootstrapping manually
128
129Before enabling CI automation, test one update locally:
130
131```bash
132cd /path/to/posprint
133./scripts/publish-aur.sh 0.4.0
134```
135
136Requirements 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.