BlueGit

timfa posprint

CI: naar BlueGit (blue-ci-cd.yml), AUR- en release-URL's naar BlueGit

timfa Ada · pushed by timfa

Authored 2026-10-27 · 3 weeks ago

Hash
c3500018f4702663248c5fe0fcf3d1f52fba608a
Parent
8ea58d5b
Pipeline
Passed
14 files changed +262 −240
.gitlab-ci.yml deleted +0 −180
@@ -1,180 +0,0 @@
1 # posprint — GitLab CI/CD (GitLab.com SaaS runners)
2 # Tests on merge requests; release builds on tags only.
3
4 # Skip empty pipelines on branch pushes (jobs are MR- or tag-only).
5 workflow:
6 rules:
7 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
8 - if: $CI_COMMIT_TAG
9
10 stages:
11 - test
12 - build
13 - release
14
15 variables:
16 CARGO_TERM_COLOR: always
17 RUST_BACKTRACE: "1"
18
19 # Linux Docker jobs: untagged → saas-linux-small-amd64 by default.
20 .default_rust:
21 image: rust:1.96-bookworm
22 before_script:
23 - rustc --version
24 - cargo --version
25
26 # Windows SaaS runner (PowerShell). Rust is not preinstalled — install via rustup.
27 .windows_saas:
28 tags:
29 - saas-windows-medium-amd64
30 before_script:
31 - |
32 if (-not (Get-Command rustc -ErrorAction SilentlyContinue)) {
33 Write-Host "Installing Rust via rustup..."
34 Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile rustup-init.exe
35 .\rustup-init.exe -y --default-toolchain stable --profile minimal
36 Remove-Item rustup-init.exe
37 }
38 $env:Path = "$env:USERPROFILE\.cargo\bin;$env:Path"
39 rustc --version
40 cargo --version
41
42 test:linux:
43 extends: .default_rust
44 stage: test
45 rules:
46 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
47 script:
48 - apt-get update -qq
49 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
50 libxkbcommon-dev libssl-dev libudev-dev pkg-config
51 - cargo test --verbose
52
53 test:windows:
54 extends: .windows_saas
55 stage: test
56 rules:
57 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
58 script:
59 - cargo test --verbose
60
61 build:linux-deb:
62 extends: .default_rust
63 stage: build
64 rules:
65 - if: $CI_COMMIT_TAG
66 before_script:
67 - apt-get update -qq
68 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
69 libxkbcommon-dev libssl-dev libudev-dev pkg-config dpkg-dev
70 - cargo install cargo-deb --locked
71 script:
72 - cargo deb
73 - mkdir -p dist
74 - cp target/debian/*.deb dist/
75 artifacts:
76 name: "posprint-linux-$CI_COMMIT_TAG"
77 paths:
78 - dist/*.deb
79 expire_in: 1 year
80
81 build:linux-arch:
82 stage: build
83 image: archlinux/archlinux:base-devel
84 rules:
85 - if: $CI_COMMIT_TAG
86 script:
87 - pacman -Syu --noconfirm
88 - pacman -S --noconfirm --needed rust pkgconf openssl libxkbcommon libxcb dbus
89 wayland libx11 fontconfig freetype2 libglvnd git rsync
90 - rustc --version
91 - export PKGVER="${CI_COMMIT_TAG#v}"
92 - sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" packaging/arch/PKGBUILD
93 - useradd -m builduser
94 - chown -R builduser:builduser "$CI_PROJECT_DIR"
95 - su builduser -c "cd $CI_PROJECT_DIR/packaging/arch && makepkg -f --noconfirm"
96 - mkdir -p "$CI_PROJECT_DIR/dist"
97 - chmod +x "$CI_PROJECT_DIR/scripts/make-linux-bin-tarball.sh"
98 # Select the non-debug package only. A glob of *.pkg.tar.zst also matches
99 # posprint-debug-*.pkg.tar.zst and used to scramble $2/$3 so the AUR tarball
100 # never landed in dist/.
101 - |
102 set -euo pipefail
103 shopt -s nullglob
104 mains=("$CI_PROJECT_DIR"/packaging/arch/posprint-${PKGVER}-*-x86_64.pkg.tar.zst)
105 shopt -u nullglob
106 if [[ ${#mains[@]} -ne 1 ]]; then
107 echo "Expected one non-debug Arch package, found ${#mains[@]}" >&2
108 ls -la "$CI_PROJECT_DIR/packaging/arch" >&2 || true
109 exit 1
110 fi
111 cp "${mains[0]}" "$CI_PROJECT_DIR/dist/"
112 out="$CI_PROJECT_DIR/dist/posprint-${PKGVER}-x86_64.tar.gz"
113 "$CI_PROJECT_DIR/scripts/make-linux-bin-tarball.sh" "${mains[0]}" "$out" "$PKGVER"
114 test -s "$out"
115 artifacts:
116 name: "posprint-arch-$CI_COMMIT_TAG"
117 paths:
118 - dist/*.pkg.tar.zst
119 - dist/posprint-*-x86_64.tar.gz
120 expire_in: 1 year
121
122 build:windows:
123 extends: .windows_saas
124 stage: build
125 rules:
126 - if: $CI_COMMIT_TAG
127 script:
128 - cargo build --release
129 - New-Item -ItemType Directory -Force -Path dist | Out-Null
130 - Copy-Item target\release\posprint.exe dist\
131 artifacts:
132 name: "posprint-windows-$CI_COMMIT_TAG"
133 paths:
134 - dist/posprint.exe
135 expire_in: 1 year
136
137 release:gitlab:
138 stage: release
139 image: alpine:3.21
140 rules:
141 - if: $CI_COMMIT_TAG
142 needs:
143 - job: build:linux-deb
144 artifacts: true
145 - job: build:linux-arch
146 artifacts: true
147 - job: build:windows
148 artifacts: true
149 before_script:
150 - apk add --no-cache bash curl jq
151 - chmod +x scripts/publish-gitlab-release.sh
152 script:
153 # Discover real filenames in dist/ (cargo-deb uses posprint_<ver>-1_amd64.deb;
154 # makepkg uses posprint-<ver>-1-x86_64.pkg.tar.zst). Upload them to the
155 # Generic Package Registry and attach durable Release download links.
156 - ./scripts/publish-gitlab-release.sh
157
158 publish:aur:
159 stage: release
160 image: archlinux/archlinux:base-devel
161 rules:
162 - if: $CI_COMMIT_TAG
163 # AUR outage must not fail the whole tag pipeline (job-artifact permalinks
164 # 404 when the latest pipeline for the tag is failed). Prefer success; this
165 # is only a safety net.
166 allow_failure: true
167 needs:
168 - release:gitlab
169 - job: build:linux-arch
170 artifacts: true
171 before_script:
172 # Only tools needed to update the AUR git repo (no Rust GUI build deps).
173 # Do not install package name "cargo" — it prompts for a provider (rust vs rustup).
174 - pacman -Syu --noconfirm
175 - pacman -S --noconfirm --needed git openssh curl coreutils shadow util-linux
176 - chmod +x scripts/aur-ssh-setup.sh
177 - ./scripts/aur-ssh-setup.sh
178 script:
179 - chmod +x scripts/publish-aur.sh
180 - ./scripts/publish-aur.sh "$CI_COMMIT_TAG"
@@ -1,180 +0,0 @@
1# posprint — GitLab CI/CD (GitLab.com SaaS runners)
2# Tests on merge requests; release builds on tags only.
3
4# Skip empty pipelines on branch pushes (jobs are MR- or tag-only).
5workflow:
6 rules:
7 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
8 - if: $CI_COMMIT_TAG
9
10stages:
11 - test
12 - build
13 - release
14
15variables:
16 CARGO_TERM_COLOR: always
17 RUST_BACKTRACE: "1"
18
19# Linux Docker jobs: untagged → saas-linux-small-amd64 by default.
20.default_rust:
21 image: rust:1.96-bookworm
22 before_script:
23 - rustc --version
24 - cargo --version
25
26# Windows SaaS runner (PowerShell). Rust is not preinstalled — install via rustup.
27.windows_saas:
28 tags:
29 - saas-windows-medium-amd64
30 before_script:
31 - |
32 if (-not (Get-Command rustc -ErrorAction SilentlyContinue)) {
33 Write-Host "Installing Rust via rustup..."
34 Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile rustup-init.exe
35 .\rustup-init.exe -y --default-toolchain stable --profile minimal
36 Remove-Item rustup-init.exe
37 }
38 $env:Path = "$env:USERPROFILE\.cargo\bin;$env:Path"
39 rustc --version
40 cargo --version
41
42test:linux:
43 extends: .default_rust
44 stage: test
45 rules:
46 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
47 script:
48 - apt-get update -qq
49 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
50 libxkbcommon-dev libssl-dev libudev-dev pkg-config
51 - cargo test --verbose
52
53test:windows:
54 extends: .windows_saas
55 stage: test
56 rules:
57 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
58 script:
59 - cargo test --verbose
60
61build:linux-deb:
62 extends: .default_rust
63 stage: build
64 rules:
65 - if: $CI_COMMIT_TAG
66 before_script:
67 - apt-get update -qq
68 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
69 libxkbcommon-dev libssl-dev libudev-dev pkg-config dpkg-dev
70 - cargo install cargo-deb --locked
71 script:
72 - cargo deb
73 - mkdir -p dist
74 - cp target/debian/*.deb dist/
75 artifacts:
76 name: "posprint-linux-$CI_COMMIT_TAG"
77 paths:
78 - dist/*.deb
79 expire_in: 1 year
80
81build:linux-arch:
82 stage: build
83 image: archlinux/archlinux:base-devel
84 rules:
85 - if: $CI_COMMIT_TAG
86 script:
87 - pacman -Syu --noconfirm
88 - pacman -S --noconfirm --needed rust pkgconf openssl libxkbcommon libxcb dbus
89 wayland libx11 fontconfig freetype2 libglvnd git rsync
90 - rustc --version
91 - export PKGVER="${CI_COMMIT_TAG#v}"
92 - sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" packaging/arch/PKGBUILD
93 - useradd -m builduser
94 - chown -R builduser:builduser "$CI_PROJECT_DIR"
95 - su builduser -c "cd $CI_PROJECT_DIR/packaging/arch && makepkg -f --noconfirm"
96 - mkdir -p "$CI_PROJECT_DIR/dist"
97 - chmod +x "$CI_PROJECT_DIR/scripts/make-linux-bin-tarball.sh"
98 # Select the non-debug package only. A glob of *.pkg.tar.zst also matches
99 # posprint-debug-*.pkg.tar.zst and used to scramble $2/$3 so the AUR tarball
100 # never landed in dist/.
101 - |
102 set -euo pipefail
103 shopt -s nullglob
104 mains=("$CI_PROJECT_DIR"/packaging/arch/posprint-${PKGVER}-*-x86_64.pkg.tar.zst)
105 shopt -u nullglob
106 if [[ ${#mains[@]} -ne 1 ]]; then
107 echo "Expected one non-debug Arch package, found ${#mains[@]}" >&2
108 ls -la "$CI_PROJECT_DIR/packaging/arch" >&2 || true
109 exit 1
110 fi
111 cp "${mains[0]}" "$CI_PROJECT_DIR/dist/"
112 out="$CI_PROJECT_DIR/dist/posprint-${PKGVER}-x86_64.tar.gz"
113 "$CI_PROJECT_DIR/scripts/make-linux-bin-tarball.sh" "${mains[0]}" "$out" "$PKGVER"
114 test -s "$out"
115 artifacts:
116 name: "posprint-arch-$CI_COMMIT_TAG"
117 paths:
118 - dist/*.pkg.tar.zst
119 - dist/posprint-*-x86_64.tar.gz
120 expire_in: 1 year
121
122build:windows:
123 extends: .windows_saas
124 stage: build
125 rules:
126 - if: $CI_COMMIT_TAG
127 script:
128 - cargo build --release
129 - New-Item -ItemType Directory -Force -Path dist | Out-Null
130 - Copy-Item target\release\posprint.exe dist\
131 artifacts:
132 name: "posprint-windows-$CI_COMMIT_TAG"
133 paths:
134 - dist/posprint.exe
135 expire_in: 1 year
136
137release:gitlab:
138 stage: release
139 image: alpine:3.21
140 rules:
141 - if: $CI_COMMIT_TAG
142 needs:
143 - job: build:linux-deb
144 artifacts: true
145 - job: build:linux-arch
146 artifacts: true
147 - job: build:windows
148 artifacts: true
149 before_script:
150 - apk add --no-cache bash curl jq
151 - chmod +x scripts/publish-gitlab-release.sh
152 script:
153 # Discover real filenames in dist/ (cargo-deb uses posprint_<ver>-1_amd64.deb;
154 # makepkg uses posprint-<ver>-1-x86_64.pkg.tar.zst). Upload them to the
155 # Generic Package Registry and attach durable Release download links.
156 - ./scripts/publish-gitlab-release.sh
157
158publish:aur:
159 stage: release
160 image: archlinux/archlinux:base-devel
161 rules:
162 - if: $CI_COMMIT_TAG
163 # AUR outage must not fail the whole tag pipeline (job-artifact permalinks
164 # 404 when the latest pipeline for the tag is failed). Prefer success; this
165 # is only a safety net.
166 allow_failure: true
167 needs:
168 - release:gitlab
169 - job: build:linux-arch
170 artifacts: true
171 before_script:
172 # Only tools needed to update the AUR git repo (no Rust GUI build deps).
173 # Do not install package name "cargo" — it prompts for a provider (rust vs rustup).
174 - pacman -Syu --noconfirm
175 - pacman -S --noconfirm --needed git openssh curl coreutils shadow util-linux
176 - chmod +x scripts/aur-ssh-setup.sh
177 - ./scripts/aur-ssh-setup.sh
178 script:
179 - chmod +x scripts/publish-aur.sh
180 - ./scripts/publish-aur.sh "$CI_COMMIT_TAG"
README.md +3 −3
@@ -42,15 +42,15 @@ All `${Parameters}` must be supplied via `--set NAME=VALUE` or the command fails
42 42
43 43 **Linux serial:** add your user to the `dialout` group.
44 44
45 ## Releases (GitLab CI)
45 ## Releases (BlueGit CI)
46 46
47 47 | Platform | Artifact | Install |
48 48 |----------|----------|---------|
49 49 | Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
50 50 | Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint-*-x86_64.pkg.tar.zst` or AUR `posprint` / `posprint-bin` |
51 | Windows | `posprint.exe` | Download from the GitLab Release / Package Registry |
51 | Windows | `posprint.exe` | Download from the [BlueGit releases](https://git.timfalken.com/timfa/posprint/-/releases) |
52 52
53 Tag a version (e.g. `0.4.0`) to trigger release builds. Downloads are uploaded to the **Generic Package Registry** and attached to the GitLab Release (job-artifact permalinks are not used). If AUR publishing is configured, the same tag pipeline also updates the `posprint` and `posprint-bin` AUR packages.
53 Every master pipeline on [BlueGit](https://git.timfalken.com/timfa/posprint) builds all packages. Start the manual `release` job to create the next tag (highest tag + 1 patch, or `RELEASE_VERSION`) with the packages as release assets; `publish:aur` then updates the `posprint` and `posprint-bin` AUR packages. See `blue-ci-cd.yml`. Releases up to 0.5.8 are on the old [GitLab project](https://gitlab.com/Timfa/posprint/-/releases).
54 54
55 55 ## Features
56 56
@@ -42,15 +42,15 @@ All `${Parameters}` must be supplied via `--set NAME=VALUE` or the command fails
42
42
43**Linux serial:** add your user to the `dialout` group.
43**Linux serial:** add your user to the `dialout` group.
44
44
45## Releases (GitLab CI)
45## Releases (BlueGit CI)
46
46
47| Platform | Artifact | Install |
47| Platform | Artifact | Install |
48|----------|----------|---------|
48|----------|----------|---------|
49| Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
49| Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
50| Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint-*-x86_64.pkg.tar.zst` or AUR `posprint` / `posprint-bin` |
50| Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint-*-x86_64.pkg.tar.zst` or AUR `posprint` / `posprint-bin` |
51| Windows | `posprint.exe` | Download from the GitLab Release / Package Registry |
51| Windows | `posprint.exe` | Download from the [BlueGit releases](https://git.timfalken.com/timfa/posprint/-/releases) |
52
52
53Tag a version (e.g. `0.4.0`) to trigger release builds. Downloads are uploaded to the **Generic Package Registry** and attached to the GitLab Release (job-artifact permalinks are not used). If AUR publishing is configured, the same tag pipeline also updates the `posprint` and `posprint-bin` AUR packages.
53Every master pipeline on [BlueGit](https://git.timfalken.com/timfa/posprint) builds all packages. Start the manual `release` job to create the next tag (highest tag + 1 patch, or `RELEASE_VERSION`) with the packages as release assets; `publish:aur` then updates the `posprint` and `posprint-bin` AUR packages. See `blue-ci-cd.yml`. Releases up to 0.5.8 are on the old [GitLab project](https://gitlab.com/Timfa/posprint/-/releases).
54
54
55## Features
55## Features
56
56
blue-ci-cd.yml added +178 −0
@@ -0,0 +1,178 @@
1 # posprint — BlueGit CI (git.timfalken.com/timfa/posprint).
2 # Migrated from the old .gitlab-ci.yml (GitLab is now a backup only).
3 #
4 # Merge request / any branch push: test.
5 # Master: test + all release builds + AUR dry run (nothing is published).
6 # `release` is manual on master: it creates the next tag (highest tag + 1
7 # patch, or Cargo.toml if higher; override with RELEASE_VERSION) through the
8 # BlueGit release API with the build artifacts as assets. Then publish:aur
9 # updates the AUR packages posprint and posprint-bin.
10 # Tag pushes never run a pipeline (old tags must not rebuild).
11 #
12 # Secrets (repository, protected): AUR_SSH_PRIVATE_KEY_B64,
13 # AUR_GIT_AUTHOR_NAME, AUR_GIT_AUTHOR_EMAIL.
14
15 stages: [test, build, release, publish]
16
17 variables:
18 CARGO_TERM_COLOR: always
19 RUST_BACKTRACE: "1"
20 CARGO_BUILD_JOBS: "3"
21 CARGO_PROFILE_DEV_DEBUG: "false"
22 CARGO_PROFILE_TEST_DEBUG: "false"
23
24 workflow:
25 rules:
26 - if: $CI_COMMIT_TAG != ""
27 when: never
28 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
29 - if: $CI_COMMIT_BRANCH == "master"
30 - if: $CI_PIPELINE_SOURCE == "web"
31 - if: $CI_PIPELINE_SOURCE == "api"
32
33 .master:
34 rules:
35 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
36 when: never
37 - if: $CI_COMMIT_BRANCH == "master"
38
39 .rust:
40 image: rust:1.96-bookworm
41 timeout: 2h
42 before_script:
43 - export CARGO_HOME="$CI_PROJECT_DIR/cargo-home"
44 - export PATH="$CARGO_HOME/bin:$PATH"
45 - apt-get update -qq
46 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libudev-dev libdbus-1-dev pkg-config
47
48 test:
49 extends: .rust
50 stage: test
51 cache:
52 key: cargo-test
53 paths: [target/, cargo-home/]
54 script:
55 - cargo test --verbose
56
57 version:
58 extends: .master
59 stage: test
60 image: bluegit/base
61 needs: []
62 script:
63 - mkdir -p artifacts
64 - bash scripts/ci/next-version.sh | tee artifacts/version.txt
65 artifacts:
66 paths: [artifacts/version.txt]
67 expire_in: 14d
68
69 build:linux-deb:
70 extends: [.rust, .master]
71 stage: build
72 needs: [version, test]
73 cache:
74 key: cargo-deb
75 paths: [target/, cargo-home/]
76 script:
77 - apt-get install -y -qq dpkg-dev
78 - cargo install cargo-deb --locked
79 - bash scripts/ci/set-version.sh
80 - cargo deb
81 - mkdir -p dist
82 - cp target/debian/*.deb dist/
83 artifacts:
84 paths: [dist/*.deb]
85 expire_in: 30d
86
87 build:linux-arch:
88 extends: .master
89 stage: build
90 image: archlinux/archlinux:base-devel
91 timeout: 2h
92 needs: [version, test]
93 script:
94 - pacman -Syu --noconfirm
95 - pacman -S --noconfirm --needed rust pkgconf openssl libxkbcommon libxcb dbus wayland libx11 fontconfig freetype2 libglvnd git rsync
96 - bash scripts/ci/set-version.sh
97 - export PKGVER="$(cat artifacts/version.txt)"
98 - sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" packaging/arch/PKGBUILD
99 - useradd -m builduser
100 - chown -R builduser:builduser "$CI_PROJECT_DIR"
101 - su builduser -c "cd $CI_PROJECT_DIR/packaging/arch && makepkg -f --noconfirm"
102 - mkdir -p "$CI_PROJECT_DIR/dist"
103 - |
104 set -euo pipefail
105 shopt -s nullglob
106 mains=("$CI_PROJECT_DIR"/packaging/arch/posprint-${PKGVER}-*-x86_64.pkg.tar.zst)
107 shopt -u nullglob
108 if [[ ${#mains[@]} -ne 1 ]]; then
109 echo "Expected one non-debug Arch package, found ${#mains[@]}" >&2
110 exit 1
111 fi
112 cp "${mains[0]}" "$CI_PROJECT_DIR/dist/"
113 out="$CI_PROJECT_DIR/dist/posprint-${PKGVER}-x86_64.tar.gz"
114 bash "$CI_PROJECT_DIR/scripts/make-linux-bin-tarball.sh" "${mains[0]}" "$out" "$PKGVER"
115 test -s "$out"
116 artifacts:
117 paths: [dist/*.pkg.tar.zst, dist/posprint-*-x86_64.tar.gz]
118 expire_in: 30d
119
120 # Cross-compiled with MinGW (no Windows runner on BlueGit).
121 build:windows:
122 extends: [.rust, .master]
123 stage: build
124 needs: [version, test]
125 cache:
126 key: cargo-windows
127 paths: [target/, cargo-home/]
128 before_script:
129 - export CARGO_HOME="$CI_PROJECT_DIR/cargo-home"
130 - export PATH="$CARGO_HOME/bin:$PATH"
131 - apt-get update -qq
132 - apt-get install -y -qq gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64
133 - rustup target add x86_64-pc-windows-gnu
134 script:
135 - bash scripts/ci/set-version.sh
136 - cargo build --release --locked --target x86_64-pc-windows-gnu
137 - mkdir -p dist
138 - cp target/x86_64-pc-windows-gnu/release/posprint.exe dist/
139 artifacts:
140 paths: [dist/posprint.exe]
141 expire_in: 30d
142
143 # Safe AUR check on every master pipeline: real SSH key and AUR clone,
144 # PKGBUILD/.SRCINFO generation, but AUR_DRY_RUN=1 never pushes.
145 aur:dry-run:
146 extends: .master
147 stage: release
148 image: archlinux/archlinux:base-devel
149 needs: [version, build:linux-arch]
150 allow_failure: true
151 script:
152 - pacman -Syu --noconfirm --needed git openssh curl coreutils shadow util-linux
153 - bash scripts/aur-ssh-setup.sh
154 - last="$(git tag -l | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1)"
155 - export POSPRINT_SOURCE_ARCHIVE_URL="$CI_API_URL/projects/$CI_PROJECT_PATH/repository/tags/$last/archive"
156 - AUR_DRY_RUN=1 bash scripts/publish-aur.sh "$(cat artifacts/version.txt)"
157
158 release:
159 extends: .master
160 stage: release
161 image: bluegit/base
162 needs: [version, build:linux-deb, build:linux-arch, build:windows]
163 when: manual
164 resource_group: release
165 script:
166 - bash scripts/ci/release.sh
167
168 publish:aur:
169 extends: .master
170 stage: publish
171 image: archlinux/archlinux:base-devel
172 needs: [version, release, build:linux-arch]
173 allow_failure: true
174 resource_group: aur
175 script:
176 - pacman -Syu --noconfirm --needed git openssh curl coreutils shadow util-linux
177 - bash scripts/aur-ssh-setup.sh
178 - bash scripts/publish-aur.sh "$(cat artifacts/version.txt)"
@@ -0,0 +1,178 @@
1# posprint — BlueGit CI (git.timfalken.com/timfa/posprint).
2# Migrated from the old .gitlab-ci.yml (GitLab is now a backup only).
3#
4# Merge request / any branch push: test.
5# Master: test + all release builds + AUR dry run (nothing is published).
6# `release` is manual on master: it creates the next tag (highest tag + 1
7# patch, or Cargo.toml if higher; override with RELEASE_VERSION) through the
8# BlueGit release API with the build artifacts as assets. Then publish:aur
9# updates the AUR packages posprint and posprint-bin.
10# Tag pushes never run a pipeline (old tags must not rebuild).
11#
12# Secrets (repository, protected): AUR_SSH_PRIVATE_KEY_B64,
13# AUR_GIT_AUTHOR_NAME, AUR_GIT_AUTHOR_EMAIL.
14
15stages: [test, build, release, publish]
16
17variables:
18 CARGO_TERM_COLOR: always
19 RUST_BACKTRACE: "1"
20 CARGO_BUILD_JOBS: "3"
21 CARGO_PROFILE_DEV_DEBUG: "false"
22 CARGO_PROFILE_TEST_DEBUG: "false"
23
24workflow:
25 rules:
26 - if: $CI_COMMIT_TAG != ""
27 when: never
28 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
29 - if: $CI_COMMIT_BRANCH == "master"
30 - if: $CI_PIPELINE_SOURCE == "web"
31 - if: $CI_PIPELINE_SOURCE == "api"
32
33.master:
34 rules:
35 - if: $CI_PIPELINE_SOURCE == "merge_request_event"
36 when: never
37 - if: $CI_COMMIT_BRANCH == "master"
38
39.rust:
40 image: rust:1.96-bookworm
41 timeout: 2h
42 before_script:
43 - export CARGO_HOME="$CI_PROJECT_DIR/cargo-home"
44 - export PATH="$CARGO_HOME/bin:$PATH"
45 - apt-get update -qq
46 - apt-get install -y -qq libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libudev-dev libdbus-1-dev pkg-config
47
48test:
49 extends: .rust
50 stage: test
51 cache:
52 key: cargo-test
53 paths: [target/, cargo-home/]
54 script:
55 - cargo test --verbose
56
57version:
58 extends: .master
59 stage: test
60 image: bluegit/base
61 needs: []
62 script:
63 - mkdir -p artifacts
64 - bash scripts/ci/next-version.sh | tee artifacts/version.txt
65 artifacts:
66 paths: [artifacts/version.txt]
67 expire_in: 14d
68
69build:linux-deb:
70 extends: [.rust, .master]
71 stage: build
72 needs: [version, test]
73 cache:
74 key: cargo-deb
75 paths: [target/, cargo-home/]
76 script:
77 - apt-get install -y -qq dpkg-dev
78 - cargo install cargo-deb --locked
79 - bash scripts/ci/set-version.sh
80 - cargo deb
81 - mkdir -p dist
82 - cp target/debian/*.deb dist/
83 artifacts:
84 paths: [dist/*.deb]
85 expire_in: 30d
86
87build:linux-arch:
88 extends: .master
89 stage: build
90 image: archlinux/archlinux:base-devel
91 timeout: 2h
92 needs: [version, test]
93 script:
94 - pacman -Syu --noconfirm
95 - pacman -S --noconfirm --needed rust pkgconf openssl libxkbcommon libxcb dbus wayland libx11 fontconfig freetype2 libglvnd git rsync
96 - bash scripts/ci/set-version.sh
97 - export PKGVER="$(cat artifacts/version.txt)"
98 - sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" packaging/arch/PKGBUILD
99 - useradd -m builduser
100 - chown -R builduser:builduser "$CI_PROJECT_DIR"
101 - su builduser -c "cd $CI_PROJECT_DIR/packaging/arch && makepkg -f --noconfirm"
102 - mkdir -p "$CI_PROJECT_DIR/dist"
103 - |
104 set -euo pipefail
105 shopt -s nullglob
106 mains=("$CI_PROJECT_DIR"/packaging/arch/posprint-${PKGVER}-*-x86_64.pkg.tar.zst)
107 shopt -u nullglob
108 if [[ ${#mains[@]} -ne 1 ]]; then
109 echo "Expected one non-debug Arch package, found ${#mains[@]}" >&2
110 exit 1
111 fi
112 cp "${mains[0]}" "$CI_PROJECT_DIR/dist/"
113 out="$CI_PROJECT_DIR/dist/posprint-${PKGVER}-x86_64.tar.gz"
114 bash "$CI_PROJECT_DIR/scripts/make-linux-bin-tarball.sh" "${mains[0]}" "$out" "$PKGVER"
115 test -s "$out"
116 artifacts:
117 paths: [dist/*.pkg.tar.zst, dist/posprint-*-x86_64.tar.gz]
118 expire_in: 30d
119
120# Cross-compiled with MinGW (no Windows runner on BlueGit).
121build:windows:
122 extends: [.rust, .master]
123 stage: build
124 needs: [version, test]
125 cache:
126 key: cargo-windows
127 paths: [target/, cargo-home/]
128 before_script:
129 - export CARGO_HOME="$CI_PROJECT_DIR/cargo-home"
130 - export PATH="$CARGO_HOME/bin:$PATH"
131 - apt-get update -qq
132 - apt-get install -y -qq gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64
133 - rustup target add x86_64-pc-windows-gnu
134 script:
135 - bash scripts/ci/set-version.sh
136 - cargo build --release --locked --target x86_64-pc-windows-gnu
137 - mkdir -p dist
138 - cp target/x86_64-pc-windows-gnu/release/posprint.exe dist/
139 artifacts:
140 paths: [dist/posprint.exe]
141 expire_in: 30d
142
143# Safe AUR check on every master pipeline: real SSH key and AUR clone,
144# PKGBUILD/.SRCINFO generation, but AUR_DRY_RUN=1 never pushes.
145aur:dry-run:
146 extends: .master
147 stage: release
148 image: archlinux/archlinux:base-devel
149 needs: [version, build:linux-arch]
150 allow_failure: true
151 script:
152 - pacman -Syu --noconfirm --needed git openssh curl coreutils shadow util-linux
153 - bash scripts/aur-ssh-setup.sh
154 - last="$(git tag -l | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1)"
155 - export POSPRINT_SOURCE_ARCHIVE_URL="$CI_API_URL/projects/$CI_PROJECT_PATH/repository/tags/$last/archive"
156 - AUR_DRY_RUN=1 bash scripts/publish-aur.sh "$(cat artifacts/version.txt)"
157
158release:
159 extends: .master
160 stage: release
161 image: bluegit/base
162 needs: [version, build:linux-deb, build:linux-arch, build:windows]
163 when: manual
164 resource_group: release
165 script:
166 - bash scripts/ci/release.sh
167
168publish:aur:
169 extends: .master
170 stage: publish
171 image: archlinux/archlinux:base-devel
172 needs: [version, release, build:linux-arch]
173 allow_failure: true
174 resource_group: aur
175 script:
176 - pacman -Syu --noconfirm --needed git openssh curl coreutils shadow util-linux
177 - bash scripts/aur-ssh-setup.sh
178 - bash scripts/publish-aur.sh "$(cat artifacts/version.txt)"
docs/AUR.md +3 −1
@@ -1,6 +1,8 @@
1 1 # AUR publishing
2 2
3 How `posprint` is published to the Arch User Repository (AUR) from GitLab tags.
3 How `posprint` is published to the Arch User Repository (AUR).
4
5 > Since the move to BlueGit, the `release` and `publish:aur` jobs in `blue-ci-cd.yml` do this (source: BlueGit tag archive, binary: BlueGit release asset). The GitLab-specific notes below are kept for history; secrets are BlueGit repository secrets with the same names.
4 6
5 7 ## Chosen approach
6 8
@@ -1,6 +1,8 @@
1# AUR publishing
1# AUR publishing
2
2
3How `posprint` is published to the Arch User Repository (AUR) from GitLab tags.
3How `posprint` is published to the Arch User Repository (AUR).
4
5> Since the move to BlueGit, the `release` and `publish:aur` jobs in `blue-ci-cd.yml` do this (source: BlueGit tag archive, binary: BlueGit release asset). The GitLab-specific notes below are kept for history; secrets are BlueGit repository secrets with the same names.
4
6
5## Chosen approach
7## Chosen approach
6
8
packaging/arch/PKGBUILD +1 −1
@@ -4,7 +4,7 @@ pkgver=0.5.7
4 4 pkgrel=1
5 5 pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
6 6 arch=('x86_64')
7 url="https://gitlab.com/Timfa/posprint"
7 url="https://git.timfalken.com/timfa/posprint"
8 8 license=('MIT')
9 9 conflicts=('posprint-bin')
10 10 depends=(
@@ -4,7 +4,7 @@ pkgver=0.5.7
4pkgrel=1
4pkgrel=1
5pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
5pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
6arch=('x86_64')
6arch=('x86_64')
7url="https://gitlab.com/Timfa/posprint"
7url="https://git.timfalken.com/timfa/posprint"
8license=('MIT')
8license=('MIT')
9conflicts=('posprint-bin')
9conflicts=('posprint-bin')
10depends=(
10depends=(
packaging/aur-bin/.SRCINFO +2 −2
@@ -2,7 +2,7 @@ pkgbase = posprint-bin
2 2 pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing (prebuilt binary)
3 3 pkgver = 0.5.7
4 4 pkgrel = 1
5 url = https://gitlab.com/Timfa/posprint
5 url = https://git.timfalken.com/timfa/posprint
6 6 arch = x86_64
7 7 license = MIT
8 8 provides = posprint=0.5.7
@@ -19,7 +19,7 @@ pkgbase = posprint-bin
19 19 depends = libglvnd
20 20 options = !strip
21 21 options = !debug
22 source = posprint-0.5.7-x86_64.tar.gz::https://gitlab.com/api/v4/projects/Timfa%2Fposprint/packages/generic/posprint/0.5.7/posprint-0.5.7-x86_64.tar.gz
22 source = posprint-0.5.7-x86_64.tar.gz::https://git.timfalken.com/timfa/posprint/-/releases/0.5.7/assets/posprint-0.5.7-x86_64.tar.gz
23 23 sha256sums = 0000000000000000000000000000000000000000000000000000000000000000
24 24
25 25 pkgname = posprint-bin
@@ -2,7 +2,7 @@ pkgbase = posprint-bin
2 pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing (prebuilt binary)
2 pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing (prebuilt binary)
3 pkgver = 0.5.7
3 pkgver = 0.5.7
4 pkgrel = 1
4 pkgrel = 1
5 url = https://gitlab.com/Timfa/posprint
5 url = https://git.timfalken.com/timfa/posprint
6 arch = x86_64
6 arch = x86_64
7 license = MIT
7 license = MIT
8 provides = posprint=0.5.7
8 provides = posprint=0.5.7
@@ -19,7 +19,7 @@ pkgbase = posprint-bin
19 depends = libglvnd
19 depends = libglvnd
20 options = !strip
20 options = !strip
21 options = !debug
21 options = !debug
22 source = posprint-0.5.7-x86_64.tar.gz::https://gitlab.com/api/v4/projects/Timfa%2Fposprint/packages/generic/posprint/0.5.7/posprint-0.5.7-x86_64.tar.gz
22 source = posprint-0.5.7-x86_64.tar.gz::https://git.timfalken.com/timfa/posprint/-/releases/0.5.7/assets/posprint-0.5.7-x86_64.tar.gz
23 sha256sums = 0000000000000000000000000000000000000000000000000000000000000000
23 sha256sums = 0000000000000000000000000000000000000000000000000000000000000000
24
24
25pkgname = posprint-bin
25pkgname = posprint-bin
packaging/aur-bin/PKGBUILD +2 −2
@@ -4,7 +4,7 @@ pkgver=0.5.7
4 4 pkgrel=1
5 5 pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing (prebuilt binary)"
6 6 arch=('x86_64')
7 url="https://gitlab.com/Timfa/posprint"
7 url="https://git.timfalken.com/timfa/posprint"
8 8 license=('MIT')
9 9 depends=(
10 10 'gcc-libs'
@@ -21,7 +21,7 @@ depends=(
21 21 provides=("posprint=${pkgver}")
22 22 conflicts=('posprint')
23 23 options=('!strip' '!debug')
24 source=("posprint-${pkgver}-x86_64.tar.gz::https://gitlab.com/api/v4/projects/Timfa%2Fposprint/packages/generic/posprint/${pkgver}/posprint-${pkgver}-x86_64.tar.gz")
24 source=("posprint-${pkgver}-x86_64.tar.gz::https://git.timfalken.com/timfa/posprint/-/releases/${pkgver}/assets/posprint-${pkgver}-x86_64.tar.gz")
25 25 sha256sums=('0000000000000000000000000000000000000000000000000000000000000000')
26 26
27 27 package() {
@@ -4,7 +4,7 @@ pkgver=0.5.7
4pkgrel=1
4pkgrel=1
5pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing (prebuilt binary)"
5pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing (prebuilt binary)"
6arch=('x86_64')
6arch=('x86_64')
7url="https://gitlab.com/Timfa/posprint"
7url="https://git.timfalken.com/timfa/posprint"
8license=('MIT')
8license=('MIT')
9depends=(
9depends=(
10 'gcc-libs'
10 'gcc-libs'
@@ -21,7 +21,7 @@ depends=(
21provides=("posprint=${pkgver}")
21provides=("posprint=${pkgver}")
22conflicts=('posprint')
22conflicts=('posprint')
23options=('!strip' '!debug')
23options=('!strip' '!debug')
24source=("posprint-${pkgver}-x86_64.tar.gz::https://gitlab.com/api/v4/projects/Timfa%2Fposprint/packages/generic/posprint/${pkgver}/posprint-${pkgver}-x86_64.tar.gz")
24source=("posprint-${pkgver}-x86_64.tar.gz::https://git.timfalken.com/timfa/posprint/-/releases/${pkgver}/assets/posprint-${pkgver}-x86_64.tar.gz")
25sha256sums=('0000000000000000000000000000000000000000000000000000000000000000')
25sha256sums=('0000000000000000000000000000000000000000000000000000000000000000')
26
26
27package() {
27package() {
packaging/aur/.SRCINFO +2 −2
@@ -2,7 +2,7 @@ pkgbase = posprint
2 2 pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing
3 3 pkgver = 0.5.7
4 4 pkgrel = 1
5 url = https://gitlab.com/Timfa/posprint
5 url = https://git.timfalken.com/timfa/posprint
6 6 arch = x86_64
7 7 license = MIT
8 8 conflicts = posprint-bin
@@ -22,7 +22,7 @@ pkgbase = posprint
22 22 depends = freetype2
23 23 depends = libglvnd
24 24 options = !lto
25 source = https://gitlab.com/Timfa/posprint/-/archive/0.5.7/posprint-0.5.7.tar.gz
25 source = posprint-0.5.7.tar.gz::https://git.timfalken.com/api/v1/projects/timfa/posprint/repository/tags/0.5.7/archive
26 26 sha256sums = SKIP
27 27
28 28 pkgname = posprint
@@ -2,7 +2,7 @@ pkgbase = posprint
2 pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing
2 pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing
3 pkgver = 0.5.7
3 pkgver = 0.5.7
4 pkgrel = 1
4 pkgrel = 1
5 url = https://gitlab.com/Timfa/posprint
5 url = https://git.timfalken.com/timfa/posprint
6 arch = x86_64
6 arch = x86_64
7 license = MIT
7 license = MIT
8 conflicts = posprint-bin
8 conflicts = posprint-bin
@@ -22,7 +22,7 @@ pkgbase = posprint
22 depends = freetype2
22 depends = freetype2
23 depends = libglvnd
23 depends = libglvnd
24 options = !lto
24 options = !lto
25 source = https://gitlab.com/Timfa/posprint/-/archive/0.5.7/posprint-0.5.7.tar.gz
25 source = posprint-0.5.7.tar.gz::https://git.timfalken.com/api/v1/projects/timfa/posprint/repository/tags/0.5.7/archive
26 sha256sums = SKIP
26 sha256sums = SKIP
27
27
28pkgname = posprint
28pkgname = posprint
packaging/aur/PKGBUILD +2 −2
@@ -4,7 +4,7 @@ pkgver=0.5.7
4 4 pkgrel=1
5 5 pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
6 6 arch=('x86_64')
7 url="https://gitlab.com/Timfa/posprint"
7 url="https://git.timfalken.com/timfa/posprint"
8 8 license=('MIT')
9 9 conflicts=('posprint-bin')
10 10 depends=(
@@ -21,7 +21,7 @@ depends=(
21 21 )
22 22 makedepends=('rust' 'cargo' 'pkgconf' 'git' 'rsync')
23 23 options=('!lto')
24 source=("https://gitlab.com/Timfa/posprint/-/archive/${pkgver}/posprint-${pkgver}.tar.gz")
24 source=("posprint-${pkgver}.tar.gz::https://git.timfalken.com/api/v1/projects/timfa/posprint/repository/tags/${pkgver}/archive")
25 25 sha256sums=('b54a73c38deb9c57388039b00fd451038264b6fa3694348456108fb3c117f923')
26 26
27 27 build() {
@@ -4,7 +4,7 @@ pkgver=0.5.7
4pkgrel=1
4pkgrel=1
5pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
5pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
6arch=('x86_64')
6arch=('x86_64')
7url="https://gitlab.com/Timfa/posprint"
7url="https://git.timfalken.com/timfa/posprint"
8license=('MIT')
8license=('MIT')
9conflicts=('posprint-bin')
9conflicts=('posprint-bin')
10depends=(
10depends=(
@@ -21,7 +21,7 @@ depends=(
21)
21)
22makedepends=('rust' 'cargo' 'pkgconf' 'git' 'rsync')
22makedepends=('rust' 'cargo' 'pkgconf' 'git' 'rsync')
23options=('!lto')
23options=('!lto')
24source=("https://gitlab.com/Timfa/posprint/-/archive/${pkgver}/posprint-${pkgver}.tar.gz")
24source=("posprint-${pkgver}.tar.gz::https://git.timfalken.com/api/v1/projects/timfa/posprint/repository/tags/${pkgver}/archive")
25sha256sums=('b54a73c38deb9c57388039b00fd451038264b6fa3694348456108fb3c117f923')
25sha256sums=('b54a73c38deb9c57388039b00fd451038264b6fa3694348456108fb3c117f923')
26
26
27build() {
27build() {
scripts/ci/next-version.sh added +16 −0
@@ -0,0 +1,16 @@
1 #!/usr/bin/env bash
2 # Print the version for the next release: RELEASE_VERSION if set, otherwise
3 # the highest X.Y.Z (or vX.Y.Z) tag plus one patch, or Cargo.toml's version
4 # if that is higher. Tags are bare (e.g. 0.5.9), like on GitLab.
5 set -euo pipefail
6 cd "$(dirname "$0")/../.."
7 if [[ -n "${RELEASE_VERSION:-}" ]]; then echo "${RELEASE_VERSION#v}"; exit; fi
8 url="${CI_PROJECT_URL:-https://git.timfalken.com/timfa/posprint}.git"
9 tags="$( { git tag -l 2>/dev/null || true; git ls-remote --tags "$url" 2>/dev/null | sed 's|.*refs/tags/||' || true; } )"
10 last="$(printf '%s\n' "$tags" | sed 's/^v//' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1 || true)"
11 last="${last:-0.0.0}"
12 IFS=. read -r maj min pat <<<"$last"
13 next="${maj}.${min}.$((pat + 1))"
14 cargo="$(grep -m1 '^version = ' Cargo.toml | sed -E 's/.*"([^"]+)"/\1/')"
15 if [[ "$(printf '%s\n%s\n' "$next" "$cargo" | sort -V | tail -n1)" == "$cargo" && "$cargo" != "$last" ]]; then next="$cargo"; fi
16 echo "$next"
@@ -0,0 +1,16 @@
1#!/usr/bin/env bash
2# Print the version for the next release: RELEASE_VERSION if set, otherwise
3# the highest X.Y.Z (or vX.Y.Z) tag plus one patch, or Cargo.toml's version
4# if that is higher. Tags are bare (e.g. 0.5.9), like on GitLab.
5set -euo pipefail
6cd "$(dirname "$0")/../.."
7if [[ -n "${RELEASE_VERSION:-}" ]]; then echo "${RELEASE_VERSION#v}"; exit; fi
8url="${CI_PROJECT_URL:-https://git.timfalken.com/timfa/posprint}.git"
9tags="$( { git tag -l 2>/dev/null || true; git ls-remote --tags "$url" 2>/dev/null | sed 's|.*refs/tags/||' || true; } )"
10last="$(printf '%s\n' "$tags" | sed 's/^v//' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n1 || true)"
11last="${last:-0.0.0}"
12IFS=. read -r maj min pat <<<"$last"
13next="${maj}.${min}.$((pat + 1))"
14cargo="$(grep -m1 '^version = ' Cargo.toml | sed -E 's/.*"([^"]+)"/\1/')"
15if [[ "$(printf '%s\n%s\n' "$next" "$cargo" | sort -V | tail -n1)" == "$cargo" && "$cargo" != "$last" ]]; then next="$cargo"; fi
16echo "$next"
scripts/ci/release.sh added +20 −0
@@ -0,0 +1,20 @@
1 #!/usr/bin/env bash
2 # Create the BlueGit release on CI_COMMIT_SHA with the build artifacts as
3 # assets. The release API creates the tag itself (bare version, e.g. 0.5.9).
4 set -euo pipefail
5 : "${CI_API_URL:?}" "${CI_JOB_TOKEN:?}" "${CI_COMMIT_SHA:?}" "${CI_PROJECT_PATH:?}"
6 cd "$(dirname "$0")/../.."
7 v="$(cat artifacts/version.txt)"
8 [[ "$v" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Invalid version: $v" >&2; exit 1; }
9 now="$(bash scripts/ci/next-version.sh)"
10 [[ "$now" == "$v" ]] || { echo "Version $v is already taken (next is $now). Rerun the pipeline." >&2; exit 1; }
11 asset() { printf '{"job":"%s","path":"%s","name":"%s"}' "$1" "$2" "$3"; }
12 assets="$(asset build:linux-deb "dist/posprint_${v}-1_amd64.deb" "posprint_${v}-1_amd64.deb"),$(asset build:linux-arch "dist/posprint-${v}-1-x86_64.pkg.tar.zst" "posprint-${v}-1-x86_64.pkg.tar.zst"),$(asset build:linux-arch "dist/posprint-${v}-x86_64.tar.gz" "posprint-${v}-x86_64.tar.gz"),$(asset build:windows dist/posprint.exe posprint.exe)"
13 desc='* Debian/Ubuntu: posprint_<version>-1_amd64.deb\n* Arch: posprint-<version>-1-x86_64.pkg.tar.zst\n* Linux binary tarball (AUR posprint-bin): posprint-<version>-x86_64.tar.gz\n* Windows: posprint.exe\n\nAUR: posprint, posprint-bin.'
14 body="$(printf '{"tag":"%s","commit":"%s","name":"posprint %s","body":"%s","assets":[%s]}' "$v" "$CI_COMMIT_SHA" "$v" "$desc" "$assets")"
15 echo "Release $v on $CI_COMMIT_SHA"
16 resp="$(mktemp)"
17 code="$(curl -sS -o "$resp" -w '%{http_code}' -X POST "$CI_API_URL/repos/$CI_PROJECT_PATH/releases" \
18 -H "Authorization: Bearer $CI_JOB_TOKEN" -H "Content-Type: application/json" -d "$body")" || code=000
19 cat "$resp"; echo
20 [[ "$code" == 2* ]] || { echo "Release API returned HTTP $code" >&2; exit 1; }
@@ -0,0 +1,20 @@
1#!/usr/bin/env bash
2# Create the BlueGit release on CI_COMMIT_SHA with the build artifacts as
3# assets. The release API creates the tag itself (bare version, e.g. 0.5.9).
4set -euo pipefail
5: "${CI_API_URL:?}" "${CI_JOB_TOKEN:?}" "${CI_COMMIT_SHA:?}" "${CI_PROJECT_PATH:?}"
6cd "$(dirname "$0")/../.."
7v="$(cat artifacts/version.txt)"
8[[ "$v" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Invalid version: $v" >&2; exit 1; }
9now="$(bash scripts/ci/next-version.sh)"
10[[ "$now" == "$v" ]] || { echo "Version $v is already taken (next is $now). Rerun the pipeline." >&2; exit 1; }
11asset() { printf '{"job":"%s","path":"%s","name":"%s"}' "$1" "$2" "$3"; }
12assets="$(asset build:linux-deb "dist/posprint_${v}-1_amd64.deb" "posprint_${v}-1_amd64.deb"),$(asset build:linux-arch "dist/posprint-${v}-1-x86_64.pkg.tar.zst" "posprint-${v}-1-x86_64.pkg.tar.zst"),$(asset build:linux-arch "dist/posprint-${v}-x86_64.tar.gz" "posprint-${v}-x86_64.tar.gz"),$(asset build:windows dist/posprint.exe posprint.exe)"
13desc='* Debian/Ubuntu: posprint_<version>-1_amd64.deb\n* Arch: posprint-<version>-1-x86_64.pkg.tar.zst\n* Linux binary tarball (AUR posprint-bin): posprint-<version>-x86_64.tar.gz\n* Windows: posprint.exe\n\nAUR: posprint, posprint-bin.'
14body="$(printf '{"tag":"%s","commit":"%s","name":"posprint %s","body":"%s","assets":[%s]}' "$v" "$CI_COMMIT_SHA" "$v" "$desc" "$assets")"
15echo "Release $v on $CI_COMMIT_SHA"
16resp="$(mktemp)"
17code="$(curl -sS -o "$resp" -w '%{http_code}' -X POST "$CI_API_URL/repos/$CI_PROJECT_PATH/releases" \
18 -H "Authorization: Bearer $CI_JOB_TOKEN" -H "Content-Type: application/json" -d "$body")" || code=000
19cat "$resp"; echo
20[[ "$code" == 2* ]] || { echo "Release API returned HTTP $code" >&2; exit 1; }
scripts/ci/set-version.sh added +9 −0
@@ -0,0 +1,9 @@
1 #!/usr/bin/env bash
2 # Write the release version (artifacts/version.txt) into Cargo.toml/Cargo.lock
3 # before building, so the .deb/.pkg/.exe carry the same version as the tag.
4 set -euo pipefail
5 cd "$(dirname "$0")/../.."
6 v="$(cat artifacts/version.txt)"
7 sed -i "0,/^version = .*/s//version = \"$v\"/" Cargo.toml
8 awk -v v="$v" 'p&&/^version = /{print "version = \"" v "\"";p=0;next} /^name = "posprint"$/{p=1} {print}' Cargo.lock > Cargo.lock.new && mv Cargo.lock.new Cargo.lock
9 echo "Version: $v"
@@ -0,0 +1,9 @@
1#!/usr/bin/env bash
2# Write the release version (artifacts/version.txt) into Cargo.toml/Cargo.lock
3# before building, so the .deb/.pkg/.exe carry the same version as the tag.
4set -euo pipefail
5cd "$(dirname "$0")/../.."
6v="$(cat artifacts/version.txt)"
7sed -i "0,/^version = .*/s//version = \"$v\"/" Cargo.toml
8awk -v v="$v" 'p&&/^version = /{print "version = \"" v "\"";p=0;next} /^name = "posprint"$/{p=1} {print}' Cargo.lock > Cargo.lock.new && mv Cargo.lock.new Cargo.lock
9echo "Version: $v"
scripts/publish-aur.sh +12 −6
@@ -13,7 +13,7 @@ cd "$ROOT"
13 13 if [[ -z "$VERSION" ]]; then
14 14 VERSION="$(grep '^version = ' Cargo.toml | sed -E 's/.*"([^"]+)"/\1/')"
15 15 fi
16 # Tags may be "0.5.1" or "v0.5.1"; GitLab archive URLs and pkgver use the bare version.
16 # Tags may be "0.5.1" or "v0.5.1"; BlueGit archive URLs and pkgver use the bare version.
17 17 VERSION="${VERSION#v}"
18 18
19 19 for cmd in git makepkg sed sha256sum curl; do
@@ -24,11 +24,12 @@ if [[ "$(id -u)" -eq 0 ]]; then
24 24 command -v useradd >/dev/null || { echo "Missing command: useradd" >&2; exit 1; }
25 25 fi
26 26
27 SOURCE_ARCHIVE_URL="https://gitlab.com/Timfa/posprint/-/archive/${VERSION}/posprint-${VERSION}.tar.gz"
27 SOURCE_ARCHIVE_URL="${POSPRINT_SOURCE_ARCHIVE_URL:-https://git.timfalken.com/api/v1/projects/timfa/posprint/repository/tags/${VERSION}/archive}"
28 28 BIN_TARBALL_NAME="posprint-${VERSION}-x86_64.tar.gz"
29 # Durable Generic Package Registry URL (not jobs/artifacts/TAG permalinks — those
30 # 404 while the tag pipeline is still running or if a later job failed).
31 BIN_PACKAGE_URL="${POSPRINT_GENERIC_PACKAGE_URL:-https://gitlab.com/api/v4/projects/Timfa%2Fposprint/packages/generic/posprint/${VERSION}/${BIN_TARBALL_NAME}}"
29 # Durable BlueGit release-asset URL (not job-artifact permalinks).
30 BIN_PACKAGE_URL="${POSPRINT_RELEASE_ASSET_URL:-https://git.timfalken.com/timfa/posprint/-/releases/${VERSION}/assets/${BIN_TARBALL_NAME}}"
31 # AUR_DRY_RUN=1: build PKGBUILD/.SRCINFO and commit locally, but never push.
32 AUR_DRY_RUN="${AUR_DRY_RUN:-0}"
32 33
33 34 generate_srcinfo() {
34 35 # makepkg refuses root. mktemp parents are 0700 — aurbuild must be able to traverse
@@ -104,7 +105,12 @@ publish_package() {
104 105 else
105 106 git commit -m "initial import ${VERSION}"
106 107 fi
107 git push -u origin master
108 if [[ "$AUR_DRY_RUN" == "1" ]]; then
109 echo "DRY RUN: would push ${pkgbase} ${VERSION} to AUR (not pushed)"
110 git --no-pager show --stat HEAD
111 else
112 git push -u origin master
113 fi
108 114
109 115 echo "AUR updated: ${pkgbase} ${VERSION}"
110 116 cd "$ROOT"
@@ -13,7 +13,7 @@ cd "$ROOT"
13if [[ -z "$VERSION" ]]; then
13if [[ -z "$VERSION" ]]; then
14 VERSION="$(grep '^version = ' Cargo.toml | sed -E 's/.*"([^"]+)"/\1/')"
14 VERSION="$(grep '^version = ' Cargo.toml | sed -E 's/.*"([^"]+)"/\1/')"
15fi
15fi
16# Tags may be "0.5.1" or "v0.5.1"; GitLab archive URLs and pkgver use the bare version.
16# Tags may be "0.5.1" or "v0.5.1"; BlueGit archive URLs and pkgver use the bare version.
17VERSION="${VERSION#v}"
17VERSION="${VERSION#v}"
18
18
19for cmd in git makepkg sed sha256sum curl; do
19for cmd in git makepkg sed sha256sum curl; do
@@ -24,11 +24,12 @@ if [[ "$(id -u)" -eq 0 ]]; then
24 command -v useradd >/dev/null || { echo "Missing command: useradd" >&2; exit 1; }
24 command -v useradd >/dev/null || { echo "Missing command: useradd" >&2; exit 1; }
25fi
25fi
26
26
27SOURCE_ARCHIVE_URL="https://gitlab.com/Timfa/posprint/-/archive/${VERSION}/posprint-${VERSION}.tar.gz"
27SOURCE_ARCHIVE_URL="${POSPRINT_SOURCE_ARCHIVE_URL:-https://git.timfalken.com/api/v1/projects/timfa/posprint/repository/tags/${VERSION}/archive}"
28BIN_TARBALL_NAME="posprint-${VERSION}-x86_64.tar.gz"
28BIN_TARBALL_NAME="posprint-${VERSION}-x86_64.tar.gz"
29# Durable Generic Package Registry URL (not jobs/artifacts/TAG permalinks — those
29# Durable BlueGit release-asset URL (not job-artifact permalinks).
30# 404 while the tag pipeline is still running or if a later job failed).
30BIN_PACKAGE_URL="${POSPRINT_RELEASE_ASSET_URL:-https://git.timfalken.com/timfa/posprint/-/releases/${VERSION}/assets/${BIN_TARBALL_NAME}}"
31BIN_PACKAGE_URL="${POSPRINT_GENERIC_PACKAGE_URL:-https://gitlab.com/api/v4/projects/Timfa%2Fposprint/packages/generic/posprint/${VERSION}/${BIN_TARBALL_NAME}}"
31# AUR_DRY_RUN=1: build PKGBUILD/.SRCINFO and commit locally, but never push.
32AUR_DRY_RUN="${AUR_DRY_RUN:-0}"
32
33
33generate_srcinfo() {
34generate_srcinfo() {
34 # makepkg refuses root. mktemp parents are 0700 — aurbuild must be able to traverse
35 # makepkg refuses root. mktemp parents are 0700 — aurbuild must be able to traverse
@@ -104,7 +105,12 @@ publish_package() {
104 else
105 else
105 git commit -m "initial import ${VERSION}"
106 git commit -m "initial import ${VERSION}"
106 fi
107 fi
107 git push -u origin master
108 if [[ "$AUR_DRY_RUN" == "1" ]]; then
109 echo "DRY RUN: would push ${pkgbase} ${VERSION} to AUR (not pushed)"
110 git --no-pager show --stat HEAD
111 else
112 git push -u origin master
113 fi
108
114
109 echo "AUR updated: ${pkgbase} ${VERSION}"
115 echo "AUR updated: ${pkgbase} ${VERSION}"
110 cd "$ROOT"
116 cd "$ROOT"
tests/release_scripts.rs +12 −41
@@ -219,56 +219,27 @@ mod unix_scripts {
219 219 }
220 220
221 221 #[test]
222 fn gitlab_ci_does_not_use_tag_artifact_permalinks() {
223 let yml = include_str!("../.gitlab-ci.yml");
224 assert!(
225 !yml.contains("jobs/artifacts/"),
226 "release links must not use jobs/artifacts/TAG permalinks"
227 );
228 assert!(
229 !yml.contains("posprint_${CI_COMMIT_TAG#v}_amd64.deb"),
230 "deb link must not drop cargo-deb revision -1"
231 );
232 assert!(
233 !yml.contains("posprint_${CI_COMMIT_TAG#v}-1-x86_64.pkg.tar.zst"),
234 "pkg link must not use underscore after posprint"
235 );
236 assert!(yml.contains("publish-gitlab-release.sh"));
222 fn bluegit_ci_uses_release_api_and_aur_dry_run() {
223 let yml = include_str!("../blue-ci-cd.yml");
224 assert!(!yml.contains("jobs/artifacts/"));
225 assert!(yml.contains("scripts/ci/release.sh"));
237 226 assert!(yml.contains("make-linux-bin-tarball.sh"));
238 assert!(
239 yml.contains("build:linux-arch"),
240 "publish:aur must still need the Arch job"
241 );
227 assert!(yml.contains("AUR_DRY_RUN"));
242 228 assert!(yml.contains("allow_failure: true"));
243 229 }
244 230
245 231 #[test]
246 fn aur_bin_uses_generic_package_registry() {
232 fn aur_bin_uses_bluegit_release_assets() {
247 233 let pkgbuild = include_str!("../packaging/aur-bin/PKGBUILD");
248 234 let srcinfo = include_str!("../packaging/aur-bin/.SRCINFO");
249 235 let publish = include_str!("../scripts/publish-aur.sh");
250 for text in [pkgbuild, srcinfo] {
251 assert!(
252 !text.contains("jobs/artifacts"),
253 "AUR bin templates must not use jobs/artifacts permalinks"
254 );
255 assert!(
256 text.contains("packages/generic/posprint"),
257 "AUR bin templates must use the Generic Package Registry URL"
258 );
236 for text in [pkgbuild, srcinfo, publish] {
237 assert!(!text.contains("jobs/artifacts"));
238 assert!(!text.contains("gitlab.com"), "no GitLab URLs after the BlueGit move");
239 assert!(text.contains("git.timfalken.com/timfa/posprint/-/releases/"));
259 240 }
260 assert!(
261 publish.contains("packages/generic/posprint"),
262 "publish-aur.sh fallback must use the Generic Package Registry"
263 );
264 assert!(
265 !publish.contains("BIN_ARTIFACT_URL"),
266 "publish-aur.sh must not curl the old jobs/artifacts permalink"
267 );
268 assert!(
269 publish.contains("Using local binary tarball"),
270 "publish-aur.sh must prefer the local dist/ tarball from CI artifacts"
271 );
241 assert!(publish.contains("Using local binary tarball"));
242 assert!(publish.contains("AUR_DRY_RUN"));
272 243 }
273 244
274 245 #[test]
@@ -219,56 +219,27 @@ mod unix_scripts {
219}
219}
220
220
221#[test]
221#[test]
222fn gitlab_ci_does_not_use_tag_artifact_permalinks() {
222fn bluegit_ci_uses_release_api_and_aur_dry_run() {
223 let yml = include_str!("../.gitlab-ci.yml");
223 let yml = include_str!("../blue-ci-cd.yml");
224 assert!(
224 assert!(!yml.contains("jobs/artifacts/"));
225 !yml.contains("jobs/artifacts/"),
225 assert!(yml.contains("scripts/ci/release.sh"));
226 "release links must not use jobs/artifacts/TAG permalinks"
227 );
228 assert!(
229 !yml.contains("posprint_${CI_COMMIT_TAG#v}_amd64.deb"),
230 "deb link must not drop cargo-deb revision -1"
231 );
232 assert!(
233 !yml.contains("posprint_${CI_COMMIT_TAG#v}-1-x86_64.pkg.tar.zst"),
234 "pkg link must not use underscore after posprint"
235 );
236 assert!(yml.contains("publish-gitlab-release.sh"));
237 assert!(yml.contains("make-linux-bin-tarball.sh"));
226 assert!(yml.contains("make-linux-bin-tarball.sh"));
238 assert!(
227 assert!(yml.contains("AUR_DRY_RUN"));
239 yml.contains("build:linux-arch"),
240 "publish:aur must still need the Arch job"
241 );
242 assert!(yml.contains("allow_failure: true"));
228 assert!(yml.contains("allow_failure: true"));
243}
229}
244
230
245#[test]
231#[test]
246fn aur_bin_uses_generic_package_registry() {
232fn aur_bin_uses_bluegit_release_assets() {
247 let pkgbuild = include_str!("../packaging/aur-bin/PKGBUILD");
233 let pkgbuild = include_str!("../packaging/aur-bin/PKGBUILD");
248 let srcinfo = include_str!("../packaging/aur-bin/.SRCINFO");
234 let srcinfo = include_str!("../packaging/aur-bin/.SRCINFO");
249 let publish = include_str!("../scripts/publish-aur.sh");
235 let publish = include_str!("../scripts/publish-aur.sh");
250 for text in [pkgbuild, srcinfo] {
236 for text in [pkgbuild, srcinfo, publish] {
251 assert!(
237 assert!(!text.contains("jobs/artifacts"));
252 !text.contains("jobs/artifacts"),
238 assert!(!text.contains("gitlab.com"), "no GitLab URLs after the BlueGit move");
253 "AUR bin templates must not use jobs/artifacts permalinks"
239 assert!(text.contains("git.timfalken.com/timfa/posprint/-/releases/"));
254 );
255 assert!(
256 text.contains("packages/generic/posprint"),
257 "AUR bin templates must use the Generic Package Registry URL"
258 );
259 }
240 }
260 assert!(
241 assert!(publish.contains("Using local binary tarball"));
261 publish.contains("packages/generic/posprint"),
242 assert!(publish.contains("AUR_DRY_RUN"));
262 "publish-aur.sh fallback must use the Generic Package Registry"
263 );
264 assert!(
265 !publish.contains("BIN_ARTIFACT_URL"),
266 "publish-aur.sh must not curl the old jobs/artifacts permalink"
267 );
268 assert!(
269 publish.contains("Using local binary tarball"),
270 "publish-aur.sh must prefer the local dist/ tarball from CI artifacts"
271 );
272}
243}
273
244
274#[test]
245#[test]