Fix AUR CI key handling and bootstrap docs.
Co-authored-by: Cursor <cursoragent@cursor.com>
@@ -138,11 +138,9 @@ publish:aur:
138
138
- release:gitlab
139
139
before_script:
140
140
- pacman -Syu --noconfirm
141
- pacman -S --noconfirm --needed rust cargo pkgconf openssl libxkbcommon libxcb dbus wayland libx11 fontconfig freetype2 libglvnd git rsync curl openssh
142
- install -d -m 700 ~/.ssh
143
- printf "%s\n" "$AUR_SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
144
- chmod 600 ~/.ssh/id_ed25519
145
- ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
141
- pacman -S --noconfirm --needed rust cargo pkgconf openssl libxkbcommon libxcb dbus wayland libx11 fontconfig freetype2 libglvnd git rsync curl openssh coreutils
142
- chmod +x scripts/aur-ssh-setup.sh
143
- ./scripts/aur-ssh-setup.sh
146
144
script:
147
145
- chmod +x scripts/publish-aur.sh
148
146
- ./scripts/publish-aur.sh "$CI_COMMIT_TAG"
@@ -138,11 +138,9 @@ publish:aur:138
- release:gitlab
138
- release:gitlab
139
before_script:
139
before_script:
140
- pacman -Syu --noconfirm
140
- pacman -Syu --noconfirm
141
- pacman -S --noconfirm --needed rust cargo pkgconf openssl libxkbcommon libxcb dbus wayland libx11 fontconfig freetype2 libglvnd git rsync curl openssh
141
- pacman -S --noconfirm --needed rust cargo pkgconf openssl libxkbcommon libxcb dbus wayland libx11 fontconfig freetype2 libglvnd git rsync curl openssh coreutils
142
- install -d -m 700 ~/.ssh
142
- chmod +x scripts/aur-ssh-setup.sh
143
- printf "%s\n" "$AUR_SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
143
- ./scripts/aur-ssh-setup.sh
144
- chmod 600 ~/.ssh/id_ed25519
145
- ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
146
script:
144
script:
147
- chmod +x scripts/publish-aur.sh
145
- chmod +x scripts/publish-aur.sh
148
- ./scripts/publish-aur.sh "$CI_COMMIT_TAG"
146
- ./scripts/publish-aur.sh "$CI_COMMIT_TAG"
@@ -24,6 +24,8 @@ That keeps the AUR package simple, reproducible, and aligned with upstream tags.
24
24
| `packaging/aur/PKGBUILD` | AUR package template |
25
25
| `packaging/aur/.SRCINFO` | Initial generated metadata |
26
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 |
27
29
| `.gitlab-ci.yml` | Runs AUR publish on tags |
28
30
29
31
## Release flow
@@ -43,46 +45,78 @@ When a Git tag is pushed:
43
45
44
46
## GitLab CI secrets
45
47
46
Create these **CI/CD variables** in GitLab:
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.
47
49
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 |
50
Use **one** of these:
54
51
55
Recommended GitLab settings:
52
### Option A — File variable (simplest)
56
53
57
- mark the variables as **Protected**
58
- mark `AUR_SSH_PRIVATE_KEY` as **Masked**
59
- only allow the release/tag pipeline on protected tags
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
60
61
## How to create the AUR repository
61
Mark `AUR_SSH_PRIVATE_KEY` as **Protected**. File variables cannot be masked; that is normal for SSH keys.
62
62
63
If you have an AUR account but no package yet:
63
### Option B — Base64 (maskable)
64
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:
65
On your machine, encode the private key as **one line** (no spaces):
67
66
68
67
```bash
69
mkdir ~/posprint-aur
70
cd ~/posprint-aur
71
git init
72
git remote add origin ssh://aur@aur.archlinux.org/posprint.git
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"))
73
76
```
74
77
75
3. Copy in the initial metadata from this repo:
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:
76
103
77
104
```bash
78
cp /path/to/posprint/packaging/aur/PKGBUILD .
79
cp /path/to/posprint/packaging/aur/.SRCINFO .
105
chmod +x scripts/bootstrap-aur-repo.sh scripts/aur-ssh-setup.sh
106
./scripts/bootstrap-aur-repo.sh
80
107
```
81
108
82
4. Commit and push:
109
This copies `packaging/aur/PKGBUILD` and `.SRCINFO`, commits, and pushes to `ssh://aur@aur.archlinux.org/posprint.git`.
110
111
Manual equivalent:
83
112
84
113
```bash
114
mkdir ~/posprint-aur && cd ~/posprint-aur
115
git init
116
git remote add origin ssh://aur@aur.archlinux.org/posprint.git
85
117
git checkout -b master
118
cp /path/to/posprint/packaging/aur/PKGBUILD .
119
cp /path/to/posprint/packaging/aur/.SRCINFO .
86
120
git add PKGBUILD .SRCINFO
87
121
git commit -m "initial import"
88
122
git push origin master
@@ -24,6 +24,8 @@ That keeps the AUR package simple, reproducible, and aligned with upstream tags.24
| `packaging/aur/PKGBUILD` | AUR package template |24
| `packaging/aur/PKGBUILD` | AUR package template |25
| `packaging/aur/.SRCINFO` | Initial generated metadata |25
| `packaging/aur/.SRCINFO` | Initial generated metadata |26
| `scripts/publish-aur.sh` | Clone AUR repo, update `PKGBUILD`/`.SRCINFO`, commit, push |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 |27
| `.gitlab-ci.yml` | Runs AUR publish on tags |29
| `.gitlab-ci.yml` | Runs AUR publish on tags |28
30
29
## Release flow31
## Release flow@@ -43,46 +45,78 @@ When a Git tag is pushed:43
45
44
## GitLab CI secrets46
## GitLab CI secrets45
47
46
Create these **CI/CD variables** in GitLab: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.47
49
48
| Variable | Required | Notes |50
Use **one** of these: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
51
55
Recommended GitLab settings:52
### Option A — File variable (simplest)56
53
57
- mark the variables as **Protected**54
| Variable | Type | Value |58
- mark `AUR_SSH_PRIVATE_KEY` as **Masked**55
|----------|------|--------|59
- only allow the release/tag pipeline on protected tags56
| `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
60
61
## How to create the AUR repository61
Mark `AUR_SSH_PRIVATE_KEY` as **Protected**. File variables cannot be masked; that is normal for SSH keys.62
62
63
If you have an AUR account but no package yet:63
### Option B — Base64 (maskable)64
64
65
1. Make sure your **SSH public key** is added to your AUR account profile.65
On your machine, encode the private key as **one line** (no spaces):66
2. On an Arch machine (or any machine with `git` + `makepkg`), create a working directory:67
66
68
```bash67
```bash69
mkdir ~/posprint-aur68
# Linux70
cd ~/posprint-aur69
base64 -w0 ~/.ssh/id_ed2551971
git init70
72
git remote add origin ssh://aur@aur.archlinux.org/posprint.git71
# macOS72
base64 -i ~/.ssh/id_ed25519 | tr -d '\n'73
74
# PowerShell (Windows)75
[Convert]::ToBase64String([IO.File]::ReadAllBytes("$env:USERPROFILE\.ssh\id_ed25519"))73
```76
```74
77
75
3. Copy in the initial metadata from this repo: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 key87
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 repository97
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:76
103
77
```bash104
```bash78
cp /path/to/posprint/packaging/aur/PKGBUILD .105
chmod +x scripts/bootstrap-aur-repo.sh scripts/aur-ssh-setup.sh79
cp /path/to/posprint/packaging/aur/.SRCINFO .106
./scripts/bootstrap-aur-repo.sh80
```107
```81
108
82
4. Commit and push:109
This copies `packaging/aur/PKGBUILD` and `.SRCINFO`, commits, and pushes to `ssh://aur@aur.archlinux.org/posprint.git`.110
111
Manual equivalent:83
112
84
```bash113
```bash114
mkdir ~/posprint-aur && cd ~/posprint-aur115
git init116
git remote add origin ssh://aur@aur.archlinux.org/posprint.git85
git checkout -b master117
git checkout -b master118
cp /path/to/posprint/packaging/aur/PKGBUILD .119
cp /path/to/posprint/packaging/aur/.SRCINFO .86
git add PKGBUILD .SRCINFO120
git add PKGBUILD .SRCINFO87
git commit -m "initial import"121
git commit -m "initial import"88
git push origin master122
git push origin master@@ -25,30 +25,3 @@ pkgbase = posprint
25
25
sha256sums = b54a73c38deb9c57388039b00fd451038264b6fa3694348456108fb3c117f923
26
26
27
27
pkgname = posprint
28
pkgbase = posprint
29
pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing
30
pkgver = 0.4.0
31
pkgrel = 1
32
url = https://gitlab.com/Timfa/posprint
33
arch = x86_64
34
license = MIT
35
makedepends = rust
36
makedepends = cargo
37
makedepends = pkgconf
38
makedepends = git
39
makedepends = rsync
40
depends = gcc-libs
41
depends = libxkbcommon
42
depends = libxcb
43
depends = openssl
44
depends = dbus
45
depends = wayland
46
depends = libx11
47
depends = fontconfig
48
depends = freetype2
49
depends = libglvnd
50
options = !lto
51
source = https://gitlab.com/Timfa/posprint/-/archive/0.4.0/posprint-0.4.0.tar.gz
52
sha256sums = b54a73c38deb9c57388039b00fd451038264b6fa3694348456108fb3c117f923
53
54
pkgname = posprint
@@ -25,30 +25,3 @@ pkgbase = posprint25
sha256sums = b54a73c38deb9c57388039b00fd451038264b6fa3694348456108fb3c117f92325
sha256sums = b54a73c38deb9c57388039b00fd451038264b6fa3694348456108fb3c117f92326
26
27
pkgname = posprint27
pkgname = posprint28
pkgbase = posprint29
pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing30
pkgver = 0.4.031
pkgrel = 132
url = https://gitlab.com/Timfa/posprint33
arch = x86_6434
license = MIT35
makedepends = rust36
makedepends = cargo37
makedepends = pkgconf38
makedepends = git39
makedepends = rsync40
depends = gcc-libs41
depends = libxkbcommon42
depends = libxcb43
depends = openssl44
depends = dbus45
depends = wayland46
depends = libx1147
depends = fontconfig48
depends = freetype249
depends = libglvnd50
options = !lto51
source = https://gitlab.com/Timfa/posprint/-/archive/0.4.0/posprint-0.4.0.tar.gz52
sha256sums = b54a73c38deb9c57388039b00fd451038264b6fa3694348456108fb3c117f92353
54
pkgname = posprint@@ -0,0 +1,28 @@
1
#!/usr/bin/env bash
2
# Write ~/.ssh/id_ed25519 for AUR pushes from CI or local scripts.
3
#
4
# Supported GitLab CI variables (pick one):
5
# AUR_SSH_PRIVATE_KEY_B64 — base64-encoded private key (one line; can be Masked)
6
# AUR_SSH_PRIVATE_KEY — GitLab "File" variable (path to temp file), or raw key text
7
set -euo pipefail
8
9
KEY_PATH="${1:-$HOME/.ssh/id_ed25519}"
10
11
install -d -m 700 "$(dirname "$KEY_PATH")"
12
13
if [[ -n "${AUR_SSH_PRIVATE_KEY_B64:-}" ]]; then
14
echo "$AUR_SSH_PRIVATE_KEY_B64" | base64 -d > "$KEY_PATH"
15
elif [[ -n "${AUR_SSH_PRIVATE_KEY:-}" && -f "${AUR_SSH_PRIVATE_KEY}" ]]; then
16
# GitLab CI/CD variable type "File"
17
cp "$AUR_SSH_PRIVATE_KEY" "$KEY_PATH"
18
elif [[ -n "${AUR_SSH_PRIVATE_KEY:-}" ]]; then
19
printf '%s\n' "$AUR_SSH_PRIVATE_KEY" > "$KEY_PATH"
20
elif [[ -f "$HOME/.ssh/id_ed25519" ]]; then
21
cp "$HOME/.ssh/id_ed25519" "$KEY_PATH"
22
else
23
echo "No AUR SSH key found. Set AUR_SSH_PRIVATE_KEY_B64 or AUR_SSH_PRIVATE_KEY." >&2
24
exit 1
25
fi
26
27
chmod 600 "$KEY_PATH"
28
ssh-keyscan aur.archlinux.org >> "$HOME/.ssh/known_hosts" 2>/dev/null || true
@@ -0,0 +1,28 @@1
#!/usr/bin/env bash2
# Write ~/.ssh/id_ed25519 for AUR pushes from CI or local scripts.3
#4
# Supported GitLab CI variables (pick one):5
# AUR_SSH_PRIVATE_KEY_B64 — base64-encoded private key (one line; can be Masked)6
# AUR_SSH_PRIVATE_KEY — GitLab "File" variable (path to temp file), or raw key text7
set -euo pipefail8
9
KEY_PATH="${1:-$HOME/.ssh/id_ed25519}"10
11
install -d -m 700 "$(dirname "$KEY_PATH")"12
13
if [[ -n "${AUR_SSH_PRIVATE_KEY_B64:-}" ]]; then14
echo "$AUR_SSH_PRIVATE_KEY_B64" | base64 -d > "$KEY_PATH"15
elif [[ -n "${AUR_SSH_PRIVATE_KEY:-}" && -f "${AUR_SSH_PRIVATE_KEY}" ]]; then16
# GitLab CI/CD variable type "File"17
cp "$AUR_SSH_PRIVATE_KEY" "$KEY_PATH"18
elif [[ -n "${AUR_SSH_PRIVATE_KEY:-}" ]]; then19
printf '%s\n' "$AUR_SSH_PRIVATE_KEY" > "$KEY_PATH"20
elif [[ -f "$HOME/.ssh/id_ed25519" ]]; then21
cp "$HOME/.ssh/id_ed25519" "$KEY_PATH"22
else23
echo "No AUR SSH key found. Set AUR_SSH_PRIVATE_KEY_B64 or AUR_SSH_PRIVATE_KEY." >&224
exit 125
fi26
27
chmod 600 "$KEY_PATH"28
ssh-keyscan aur.archlinux.org >> "$HOME/.ssh/known_hosts" 2>/dev/null || true@@ -0,0 +1,34 @@
1
#!/usr/bin/env bash
2
# One-time: create the AUR package repo and push initial PKGBUILD + .SRCINFO.
3
# Run on a machine where your AUR SSH key works (same key as on aur.archlinux.org).
4
set -euo pipefail
5
6
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
7
PKGBASE="${AUR_PKGBASE:-posprint}"
8
AUR_REMOTE="ssh://aur@aur.archlinux.org/${PKGBASE}.git"
9
WORKDIR="${TMPDIR:-/tmp}/${PKGBASE}-aur-bootstrap-$$"
10
cleanup() { rm -rf "$WORKDIR"; }
11
trap cleanup EXIT
12
13
for cmd in git ssh; do
14
command -v "$cmd" >/dev/null || { echo "Missing: $cmd" >&2; exit 1; }
15
done
16
17
"$ROOT/scripts/aur-ssh-setup.sh"
18
19
mkdir -p "$WORKDIR/repo"
20
cd "$WORKDIR/repo"
21
git init
22
git remote add origin "$AUR_REMOTE"
23
git checkout -b master
24
25
cp "$ROOT/packaging/aur/PKGBUILD" .
26
cp "$ROOT/packaging/aur/.SRCINFO" .
27
28
git add PKGBUILD .SRCINFO
29
git commit -m "initial import"
30
31
echo "Pushing to $AUR_REMOTE ..."
32
git push -u origin master
33
34
echo "Done. AUR package should appear at: https://aur.archlinux.org/packages/${PKGBASE}"
@@ -0,0 +1,34 @@1
#!/usr/bin/env bash2
# One-time: create the AUR package repo and push initial PKGBUILD + .SRCINFO.3
# Run on a machine where your AUR SSH key works (same key as on aur.archlinux.org).4
set -euo pipefail5
6
ROOT="$(cd "$(dirname "$0")/.." && pwd)"7
PKGBASE="${AUR_PKGBASE:-posprint}"8
AUR_REMOTE="ssh://aur@aur.archlinux.org/${PKGBASE}.git"9
WORKDIR="${TMPDIR:-/tmp}/${PKGBASE}-aur-bootstrap-$$"10
cleanup() { rm -rf "$WORKDIR"; }11
trap cleanup EXIT12
13
for cmd in git ssh; do14
command -v "$cmd" >/dev/null || { echo "Missing: $cmd" >&2; exit 1; }15
done16
17
"$ROOT/scripts/aur-ssh-setup.sh"18
19
mkdir -p "$WORKDIR/repo"20
cd "$WORKDIR/repo"21
git init22
git remote add origin "$AUR_REMOTE"23
git checkout -b master24
25
cp "$ROOT/packaging/aur/PKGBUILD" .26
cp "$ROOT/packaging/aur/.SRCINFO" .27
28
git add PKGBUILD .SRCINFO29
git commit -m "initial import"30
31
echo "Pushing to $AUR_REMOTE ..."32
git push -u origin master33
34
echo "Done. AUR package should appear at: https://aur.archlinux.org/packages/${PKGBASE}"