BlueGit

ict rusty-teams

ci(release): Flatpak and Arch required, asset names, Windows ARM64 (#83)

metis Joe Mild · pushed by metis

Authored 2026-11-24 · 7 days ago

Hash
9214d8fc17c9e4168e1772d951af4cadc03fa53c
Parent
8a5c5082
7 files changed +243 −34
.cargo/config.toml +3 −0
@@ -2,6 +2,9 @@
2 2 [target.x86_64-pc-windows-msvc]
3 3 rustflags = ["-C", "target-feature=+crt-static"]
4 4
5 [target.aarch64-pc-windows-msvc]
6 rustflags = ["-C", "target-feature=+crt-static"]
7
5 8 [target.x86_64-unknown-linux-gnu]
6 9 linker = "clang"
7 10 rustflags = ["-C", "link-arg=-fuse-ld=mold"]
@@ -2,6 +2,9 @@
2[target.x86_64-pc-windows-msvc]
2[target.x86_64-pc-windows-msvc]
3rustflags = ["-C", "target-feature=+crt-static"]
3rustflags = ["-C", "target-feature=+crt-static"]
4
4
5[target.aarch64-pc-windows-msvc]
6rustflags = ["-C", "target-feature=+crt-static"]
7
5[target.x86_64-unknown-linux-gnu]
8[target.x86_64-unknown-linux-gnu]
6linker = "clang"
9linker = "clang"
7rustflags = ["-C", "link-arg=-fuse-ld=mold"]
10rustflags = ["-C", "link-arg=-fuse-ld=mold"]
.github/actions/setup-windows/action.yml +9 −1
@@ -15,7 +15,15 @@ runs:
15 15 shell: bash
16 16 run: |
17 17 set -euo pipefail
18 manifestPath="$(cargo metadata --format-version 1 --filter-platform x86_64-pc-windows-msvc |
18 # Git Bash on an ARM runner can report x86_64 when it is emulated.
19 # rustc's host triple is the toolchain this job will compile with.
20 host="$(rustc -vV | sed -n 's/^host: //p')"
21 case "$host" in
22 aarch64-pc-windows-msvc) filter_platform=aarch64-pc-windows-msvc ;;
23 x86_64-pc-windows-msvc) filter_platform=x86_64-pc-windows-msvc ;;
24 *) echo "unexpected rustc host: ${host:-<empty>}" >&2; exit 1 ;;
25 esac
26 manifestPath="$(cargo metadata --format-version 1 --filter-platform "$filter_platform" |
19 27 jq -re '[.packages[] | select(.name == "gpui-pre-windows") | .manifest_path] | first')"
20 28 # cygpath first, then dirname: the old `jq | xargs dirname | cygpath` chain let
21 29 # xargs eat the backslashes of the Windows manifest path as escapes, which left
@@ -15,7 +15,15 @@ runs:
15 shell: bash
15 shell: bash
16 run: |
16 run: |
17 set -euo pipefail
17 set -euo pipefail
18 manifestPath="$(cargo metadata --format-version 1 --filter-platform x86_64-pc-windows-msvc |
18 # Git Bash on an ARM runner can report x86_64 when it is emulated.
19 # rustc's host triple is the toolchain this job will compile with.
20 host="$(rustc -vV | sed -n 's/^host: //p')"
21 case "$host" in
22 aarch64-pc-windows-msvc) filter_platform=aarch64-pc-windows-msvc ;;
23 x86_64-pc-windows-msvc) filter_platform=x86_64-pc-windows-msvc ;;
24 *) echo "unexpected rustc host: ${host:-<empty>}" >&2; exit 1 ;;
25 esac
26 manifestPath="$(cargo metadata --format-version 1 --filter-platform "$filter_platform" |
19 jq -re '[.packages[] | select(.name == "gpui-pre-windows") | .manifest_path] | first')"
27 jq -re '[.packages[] | select(.name == "gpui-pre-windows") | .manifest_path] | first')"
20 # cygpath first, then dirname: the old `jq | xargs dirname | cygpath` chain let
28 # cygpath first, then dirname: the old `jq | xargs dirname | cygpath` chain let
21 # xargs eat the backslashes of the Windows manifest path as escapes, which left
29 # xargs eat the backslashes of the Windows manifest path as escapes, which left
.github/workflows/build.yml +137 −18
@@ -53,6 +53,13 @@ jobs:
53 53 - name: Build
54 54 run: cargo build -p app --release
55 55
56 # Before packaging. A later Flatpak or package failure must not drop the binary.
57 - uses: actions/upload-artifact@v7
58 with:
59 name: teams-linux-amd64
60 path: target/release/teams
61 if-no-files-found: error
62
56 63 # nfpm builds the deb and rpm, zsync the AppImage's .zsync; desktop-file-utils
57 64 # and appstream validate the metadata. AppImage tooling is downloaded by
58 65 # package.sh at pinned digests.
@@ -73,8 +80,33 @@ jobs:
73 80 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
74 81 run: packaging/linux/package.sh --skip-build --formats "appimage deb rpm"
75 82
83 # deb, rpm, AppImage and its .zsync. Uploaded before Arch and Flatpak, so a
84 # later failure leaves these artifacts in the run.
85 - uses: actions/upload-artifact@v7
86 with:
87 name: teams-linux-packages
88 path: dist/release/*
89 if-no-files-found: error
90
91 # Arch is its own artifact. A failure here does not drop deb/rpm/AppImage,
92 # and Flatpak still runs. The job goes red at the end if either is missing.
93 - name: Arch
94 id: arch
95 continue-on-error: true
96 env:
97 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
98 run: packaging/linux/package.sh --skip-build --formats archlinux
99
100 - uses: actions/upload-artifact@v7
101 if: steps.arch.outcome == 'success'
102 with:
103 name: teams-linux-arch
104 path: dist/release/*.pkg.tar.zst
105 if-no-files-found: error
106
76 107 # The Flatpak repackages a tarball built only for it; the release keeps its own tarball.
77 108 - name: Flatpak
109 id: flatpak
78 110 continue-on-error: true
79 111 env:
80 112 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
@@ -85,16 +117,18 @@ jobs:
85 117 DIST="$RUNNER_TEMP/flatpak" packaging/linux/package.sh --skip-build --formats tar
86 118 packaging/linux/flatpak-bundle.sh --no-test "$RUNNER_TEMP"/flatpak/rusty-teams-*-linux-x86_64.tar.gz
87 119
88 # The runner is x86_64; the artifact name carries the architecture.
89 120 - uses: actions/upload-artifact@v7
121 if: steps.flatpak.outcome == 'success'
90 122 with:
91 name: teams-linux-amd64
92 path: target/release/teams
123 name: teams-linux-flatpak
124 path: dist/release/*.flatpak
125 if-no-files-found: error
93 126
94 - uses: actions/upload-artifact@v7
95 with:
96 name: teams-linux-packages
97 path: dist/release/*
127 - name: Require Arch and Flatpak
128 if: steps.arch.outcome != 'success' || steps.flatpak.outcome != 'success'
129 run: |
130 echo "arch=${{ steps.arch.outcome }} flatpak=${{ steps.flatpak.outcome }}"
131 exit 1
98 132
99 133 windows:
100 134 name: Windows
@@ -125,6 +159,33 @@ jobs:
125 159 name: teams-windows-amd64
126 160 path: target/release/teams.exe
127 161
162 windows-arm:
163 name: Windows ARM64
164 runs-on: windows-11-arm
165 timeout-minutes: 90
166 defaults:
167 run:
168 shell: bash
169 steps:
170 - uses: actions/checkout@v6
171
172 - uses: dtolnay/rust-toolchain@stable
173
174 - uses: Swatinem/rust-cache@v2
175 with:
176 key: build-windows-arm
177
178 # After the toolchain: staging runs `cargo metadata` for aarch64.
179 - uses: ./.github/actions/setup-windows
180
181 - name: Build
182 run: cargo build -p app --release --config "patch.crates-io.gpui-pre-windows.path=\"$GPUI_PRE_WINDOWS_PATCHED\""
183
184 - uses: actions/upload-artifact@v7
185 with:
186 name: teams-windows-arm64
187 path: target/release/teams.exe
188
128 189 macos:
129 190 name: macOS
130 191 runs-on: macos-latest
@@ -151,8 +212,10 @@ jobs:
151 212
152 213 release:
153 214 name: Release
154 needs: [linux, windows, macos]
155 if: startsWith(github.ref, 'refs/tags/v')
215 needs: [linux, windows, windows-arm, macos]
216 # A failed platform must not hide the artifacts the other jobs already uploaded.
217 # The job stays red afterwards when an expected asset is missing.
218 if: always() && !cancelled() && startsWith(github.ref, 'refs/tags/v')
156 219 runs-on: ubuntu-latest
157 220 permissions:
158 221 contents: write
@@ -162,23 +225,79 @@ jobs:
162 225 path: dist
163 226
164 227 # Artifacts drop the executable bit, the tarball restores it.
228 # Asset names use the version without the leading v (rusty-teams-0.5.0-…).
165 229 - name: Package
230 id: package
166 231 env:
167 232 TAG: ${{ github.ref_name }}
168 233 run: |
234 set -euo pipefail
235 ver="${TAG#v}"
169 236 mkdir release
170 chmod +x dist/teams-linux-amd64/teams
171 tar -czf "release/rusty-teams-$TAG-linux-amd64.tar.gz" -C dist/teams-linux-amd64 teams
172 # The bare binary is what the Linux self-update downloads (release_feed.rs).
173 cp dist/teams-linux-amd64/teams "release/rusty-teams-$TAG-linux-amd64"
174 cp dist/teams-windows-amd64/teams.exe "release/rusty-teams-$TAG-windows-amd64.exe"
175 cp dist/teams-macos/teams-macos.zip "release/rusty-teams-$TAG-macos-universal.zip"
176 # deb, rpm, Flatpak, AppImage and its .zsync, named rusty-teams-<version>-linux-x86_64.*;
177 # the AppImage's update information looks for that .zsync name.
178 cp dist/teams-linux-packages/* release/
237 missing=()
238 take() {
239 local src="$1" dest="$2" label="$3"
240 if [[ -f "$src" ]]; then
241 cp "$src" "$dest"
242 else
243 echo "missing $label" >&2
244 missing+=("$label")
245 fi
246 }
247 if [[ -f dist/teams-linux-amd64/teams ]]; then
248 chmod +x dist/teams-linux-amd64/teams
249 tar -czf "release/rusty-teams-$ver-linux-amd64.tar.gz" -C dist/teams-linux-amd64 teams
250 # The bare binary is what the Linux self-update downloads (release_feed.rs).
251 cp dist/teams-linux-amd64/teams "release/rusty-teams-$ver-linux-amd64"
252 else
253 missing+=("linux-amd64")
254 fi
255 take dist/teams-windows-amd64/teams.exe "release/rusty-teams-$ver-windows-amd64.exe" "windows-amd64"
256 take dist/teams-windows-arm64/teams.exe "release/rusty-teams-$ver-windows-arm64.exe" "windows-arm64"
257 take dist/teams-macos/teams-macos.zip "release/rusty-teams-$ver-macos-universal.zip" "macos"
258 shopt -s nullglob
259 packages=(dist/teams-linux-packages/*)
260 if (( ${#packages[@]} )); then
261 # deb, rpm, AppImage and its .zsync. The AppImage update information looks for that .zsync name.
262 cp "${packages[@]}" release/
263 else
264 missing+=("linux-packages")
265 fi
266 flatpaks=(dist/teams-linux-flatpak/*.flatpak)
267 if (( ${#flatpaks[@]} )); then
268 cp "${flatpaks[@]}" release/
269 else
270 missing+=("flatpak")
271 fi
272 archpkgs=(dist/teams-linux-arch/*.pkg.tar.zst)
273 if (( ${#archpkgs[@]} )); then
274 cp "${archpkgs[@]}" release/
275 else
276 missing+=("arch")
277 fi
278 assets=(release/*)
279 if (( ${#assets[@]} )); then
280 echo "publish=true" >> "$GITHUB_OUTPUT"
281 else
282 echo "publish=false" >> "$GITHUB_OUTPUT"
283 fi
284 if (( ${#missing[@]} )); then
285 echo "complete=false" >> "$GITHUB_OUTPUT"
286 echo "missing=${missing[*]}" >> "$GITHUB_OUTPUT"
287 else
288 echo "complete=true" >> "$GITHUB_OUTPUT"
289 echo "missing=" >> "$GITHUB_OUTPUT"
290 fi
179 291
180 292 - uses: softprops/action-gh-release@v3
293 if: steps.package.outputs.publish == 'true'
181 294 with:
182 295 files: release/*
183 296 generate_release_notes: true
184 297 prerelease: ${{ contains(github.ref_name, '-') }}
298
299 - name: Fail when an asset is missing
300 if: always() && !cancelled() && steps.package.outputs.complete != 'true'
301 run: |
302 echo "Published the assets that were built. Still missing: ${{ steps.package.outputs.missing }}"
303 exit 1
@@ -53,6 +53,13 @@ jobs:
53 - name: Build
53 - name: Build
54 run: cargo build -p app --release
54 run: cargo build -p app --release
55
55
56 # Before packaging. A later Flatpak or package failure must not drop the binary.
57 - uses: actions/upload-artifact@v7
58 with:
59 name: teams-linux-amd64
60 path: target/release/teams
61 if-no-files-found: error
62
56 # nfpm builds the deb and rpm, zsync the AppImage's .zsync; desktop-file-utils
63 # nfpm builds the deb and rpm, zsync the AppImage's .zsync; desktop-file-utils
57 # and appstream validate the metadata. AppImage tooling is downloaded by
64 # and appstream validate the metadata. AppImage tooling is downloaded by
58 # package.sh at pinned digests.
65 # package.sh at pinned digests.
@@ -73,8 +80,33 @@ jobs:
73 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
80 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
74 run: packaging/linux/package.sh --skip-build --formats "appimage deb rpm"
81 run: packaging/linux/package.sh --skip-build --formats "appimage deb rpm"
75
82
83 # deb, rpm, AppImage and its .zsync. Uploaded before Arch and Flatpak, so a
84 # later failure leaves these artifacts in the run.
85 - uses: actions/upload-artifact@v7
86 with:
87 name: teams-linux-packages
88 path: dist/release/*
89 if-no-files-found: error
90
91 # Arch is its own artifact. A failure here does not drop deb/rpm/AppImage,
92 # and Flatpak still runs. The job goes red at the end if either is missing.
93 - name: Arch
94 id: arch
95 continue-on-error: true
96 env:
97 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
98 run: packaging/linux/package.sh --skip-build --formats archlinux
99
100 - uses: actions/upload-artifact@v7
101 if: steps.arch.outcome == 'success'
102 with:
103 name: teams-linux-arch
104 path: dist/release/*.pkg.tar.zst
105 if-no-files-found: error
106
76 # The Flatpak repackages a tarball built only for it; the release keeps its own tarball.
107 # The Flatpak repackages a tarball built only for it; the release keeps its own tarball.
77 - name: Flatpak
108 - name: Flatpak
109 id: flatpak
78 continue-on-error: true
110 continue-on-error: true
79 env:
111 env:
80 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
112 RUSTY_TEAMS_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
@@ -85,16 +117,18 @@ jobs:
85 DIST="$RUNNER_TEMP/flatpak" packaging/linux/package.sh --skip-build --formats tar
117 DIST="$RUNNER_TEMP/flatpak" packaging/linux/package.sh --skip-build --formats tar
86 packaging/linux/flatpak-bundle.sh --no-test "$RUNNER_TEMP"/flatpak/rusty-teams-*-linux-x86_64.tar.gz
118 packaging/linux/flatpak-bundle.sh --no-test "$RUNNER_TEMP"/flatpak/rusty-teams-*-linux-x86_64.tar.gz
87
119
88 # The runner is x86_64; the artifact name carries the architecture.
89 - uses: actions/upload-artifact@v7
120 - uses: actions/upload-artifact@v7
121 if: steps.flatpak.outcome == 'success'
90 with:
122 with:
91 name: teams-linux-amd64
123 name: teams-linux-flatpak
92 path: target/release/teams
124 path: dist/release/*.flatpak
125 if-no-files-found: error
93
126
94 - uses: actions/upload-artifact@v7
127 - name: Require Arch and Flatpak
95 with:
128 if: steps.arch.outcome != 'success' || steps.flatpak.outcome != 'success'
96 name: teams-linux-packages
129 run: |
97 path: dist/release/*
130 echo "arch=${{ steps.arch.outcome }} flatpak=${{ steps.flatpak.outcome }}"
131 exit 1
98
132
99 windows:
133 windows:
100 name: Windows
134 name: Windows
@@ -125,6 +159,33 @@ jobs:
125 name: teams-windows-amd64
159 name: teams-windows-amd64
126 path: target/release/teams.exe
160 path: target/release/teams.exe
127
161
162 windows-arm:
163 name: Windows ARM64
164 runs-on: windows-11-arm
165 timeout-minutes: 90
166 defaults:
167 run:
168 shell: bash
169 steps:
170 - uses: actions/checkout@v6
171
172 - uses: dtolnay/rust-toolchain@stable
173
174 - uses: Swatinem/rust-cache@v2
175 with:
176 key: build-windows-arm
177
178 # After the toolchain: staging runs `cargo metadata` for aarch64.
179 - uses: ./.github/actions/setup-windows
180
181 - name: Build
182 run: cargo build -p app --release --config "patch.crates-io.gpui-pre-windows.path=\"$GPUI_PRE_WINDOWS_PATCHED\""
183
184 - uses: actions/upload-artifact@v7
185 with:
186 name: teams-windows-arm64
187 path: target/release/teams.exe
188
128 macos:
189 macos:
129 name: macOS
190 name: macOS
130 runs-on: macos-latest
191 runs-on: macos-latest
@@ -151,8 +212,10 @@ jobs:
151
212
152 release:
213 release:
153 name: Release
214 name: Release
154 needs: [linux, windows, macos]
215 needs: [linux, windows, windows-arm, macos]
155 if: startsWith(github.ref, 'refs/tags/v')
216 # A failed platform must not hide the artifacts the other jobs already uploaded.
217 # The job stays red afterwards when an expected asset is missing.
218 if: always() && !cancelled() && startsWith(github.ref, 'refs/tags/v')
156 runs-on: ubuntu-latest
219 runs-on: ubuntu-latest
157 permissions:
220 permissions:
158 contents: write
221 contents: write
@@ -162,23 +225,79 @@ jobs:
162 path: dist
225 path: dist
163
226
164 # Artifacts drop the executable bit, the tarball restores it.
227 # Artifacts drop the executable bit, the tarball restores it.
228 # Asset names use the version without the leading v (rusty-teams-0.5.0-…).
165 - name: Package
229 - name: Package
230 id: package
166 env:
231 env:
167 TAG: ${{ github.ref_name }}
232 TAG: ${{ github.ref_name }}
168 run: |
233 run: |
234 set -euo pipefail
235 ver="${TAG#v}"
169 mkdir release
236 mkdir release
170 chmod +x dist/teams-linux-amd64/teams
237 missing=()
171 tar -czf "release/rusty-teams-$TAG-linux-amd64.tar.gz" -C dist/teams-linux-amd64 teams
238 take() {
172 # The bare binary is what the Linux self-update downloads (release_feed.rs).
239 local src="$1" dest="$2" label="$3"
173 cp dist/teams-linux-amd64/teams "release/rusty-teams-$TAG-linux-amd64"
240 if [[ -f "$src" ]]; then
174 cp dist/teams-windows-amd64/teams.exe "release/rusty-teams-$TAG-windows-amd64.exe"
241 cp "$src" "$dest"
175 cp dist/teams-macos/teams-macos.zip "release/rusty-teams-$TAG-macos-universal.zip"
242 else
176 # deb, rpm, Flatpak, AppImage and its .zsync, named rusty-teams-<version>-linux-x86_64.*;
243 echo "missing $label" >&2
177 # the AppImage's update information looks for that .zsync name.
244 missing+=("$label")
178 cp dist/teams-linux-packages/* release/
245 fi
246 }
247 if [[ -f dist/teams-linux-amd64/teams ]]; then
248 chmod +x dist/teams-linux-amd64/teams
249 tar -czf "release/rusty-teams-$ver-linux-amd64.tar.gz" -C dist/teams-linux-amd64 teams
250 # The bare binary is what the Linux self-update downloads (release_feed.rs).
251 cp dist/teams-linux-amd64/teams "release/rusty-teams-$ver-linux-amd64"
252 else
253 missing+=("linux-amd64")
254 fi
255 take dist/teams-windows-amd64/teams.exe "release/rusty-teams-$ver-windows-amd64.exe" "windows-amd64"
256 take dist/teams-windows-arm64/teams.exe "release/rusty-teams-$ver-windows-arm64.exe" "windows-arm64"
257 take dist/teams-macos/teams-macos.zip "release/rusty-teams-$ver-macos-universal.zip" "macos"
258 shopt -s nullglob
259 packages=(dist/teams-linux-packages/*)
260 if (( ${#packages[@]} )); then
261 # deb, rpm, AppImage and its .zsync. The AppImage update information looks for that .zsync name.
262 cp "${packages[@]}" release/
263 else
264 missing+=("linux-packages")
265 fi
266 flatpaks=(dist/teams-linux-flatpak/*.flatpak)
267 if (( ${#flatpaks[@]} )); then
268 cp "${flatpaks[@]}" release/
269 else
270 missing+=("flatpak")
271 fi
272 archpkgs=(dist/teams-linux-arch/*.pkg.tar.zst)
273 if (( ${#archpkgs[@]} )); then
274 cp "${archpkgs[@]}" release/
275 else
276 missing+=("arch")
277 fi
278 assets=(release/*)
279 if (( ${#assets[@]} )); then
280 echo "publish=true" >> "$GITHUB_OUTPUT"
281 else
282 echo "publish=false" >> "$GITHUB_OUTPUT"
283 fi
284 if (( ${#missing[@]} )); then
285 echo "complete=false" >> "$GITHUB_OUTPUT"
286 echo "missing=${missing[*]}" >> "$GITHUB_OUTPUT"
287 else
288 echo "complete=true" >> "$GITHUB_OUTPUT"
289 echo "missing=" >> "$GITHUB_OUTPUT"
290 fi
179
291
180 - uses: softprops/action-gh-release@v3
292 - uses: softprops/action-gh-release@v3
293 if: steps.package.outputs.publish == 'true'
181 with:
294 with:
182 files: release/*
295 files: release/*
183 generate_release_notes: true
296 generate_release_notes: true
184 prerelease: ${{ contains(github.ref_name, '-') }}
297 prerelease: ${{ contains(github.ref_name, '-') }}
298
299 - name: Fail when an asset is missing
300 if: always() && !cancelled() && steps.package.outputs.complete != 'true'
301 run: |
302 echo "Published the assets that were built. Still missing: ${{ steps.package.outputs.missing }}"
303 exit 1
crates/app-base/src/release_feed.rs +51 −4
@@ -20,7 +20,18 @@ pub const CHECK_INTERVAL: Duration = Duration::from_secs(6 * 60 * 60);
20 20 const RELEASES_URL: &str =
21 21 "https://api.github.com/repos/danieldaeschle/rusty-teams/releases?per_page=10";
22 22 /// The release asset this platform installs, and the magic bytes it must start with.
23 #[cfg(windows)]
23 fn asset_suffix_for(os: &str, arch: &str) -> &'static str {
24 match (os, arch) {
25 ("windows", "aarch64") => "-windows-arm64.exe",
26 ("windows", _) => "-windows-amd64.exe",
27 ("linux", _) => "-linux-amd64",
28 _ => "-unsupported",
29 }
30 }
31
32 #[cfg(all(windows, target_arch = "aarch64"))]
33 const ASSET_SUFFIX: &str = "-windows-arm64.exe";
34 #[cfg(all(windows, not(target_arch = "aarch64")))]
24 35 const ASSET_SUFFIX: &str = "-windows-amd64.exe";
25 36 #[cfg(windows)]
26 37 const EXECUTABLE_MAGIC: &[u8] = b"MZ";
@@ -303,13 +314,19 @@ mod tests {
303 314
304 315 use super::*;
305 316
317 /// Published asset name drops the leading `v` (`rusty-teams-0.5.0-windows-amd64.exe`).
318 fn asset_name(tag: &str) -> String {
319 let version = tag.strip_prefix('v').unwrap_or(tag);
320 format!("rusty-teams-{version}{ASSET_SUFFIX}")
321 }
322
306 323 fn release(tag: &str, prerelease: bool) -> Release {
307 324 Release {
308 325 tag_name: tag.to_owned(),
309 326 draft: false,
310 327 prerelease,
311 328 assets: vec![ReleaseAsset {
312 name: format!("rusty-teams-{tag}{ASSET_SUFFIX}"),
329 name: asset_name(tag),
313 330 browser_download_url: format!("https://example.test/{tag}.exe"),
314 331 size: EXECUTABLE_MAGIC.len() as u64,
315 332 digest: None,
@@ -317,6 +334,36 @@ mod tests {
317 334 }
318 335 }
319 336
337 #[test]
338 fn windows_arm_and_amd64_look_for_different_exes() {
339 assert_eq!(asset_suffix_for("windows", "aarch64"), "-windows-arm64.exe");
340 assert_eq!(asset_suffix_for("windows", "x86_64"), "-windows-amd64.exe");
341 assert!(
342 !"rusty-teams-0.5.0-windows-amd64.exe"
343 .ends_with(asset_suffix_for("windows", "aarch64"))
344 );
345 assert!(
346 "rusty-teams-0.5.0-windows-arm64.exe".ends_with(asset_suffix_for("windows", "aarch64"))
347 );
348 }
349
350 #[test]
351 fn the_installed_suffix_matches_this_target() {
352 let os = if cfg!(windows) {
353 "windows"
354 } else if cfg!(target_os = "linux") {
355 "linux"
356 } else {
357 "other"
358 };
359 let arch = if cfg!(target_arch = "aarch64") {
360 "aarch64"
361 } else {
362 "x86_64"
363 };
364 assert_eq!(ASSET_SUFFIX, asset_suffix_for(os, arch));
365 }
366
320 367 #[test]
321 368 fn versions_order_like_semver() {
322 369 let version = |tag| parse_version(tag).unwrap();
@@ -381,14 +428,14 @@ mod tests {
381 428 let mut release = release("v0.5.0", false);
382 429 let binary = release.assets.remove(0);
383 430 let tarball = ReleaseAsset {
384 name: "rusty-teams-v0.5.0-linux-amd64.tar.gz".to_owned(),
431 name: "rusty-teams-0.5.0-linux-amd64.tar.gz".to_owned(),
385 432 ..binary.clone()
386 433 };
387 434 release.assets = vec![tarball.clone()];
388 435 assert!(newest_update("v0.4.0", std::slice::from_ref(&release)).is_none());
389 436 release.assets = vec![tarball, binary];
390 437 let (_, asset) = newest_update("v0.4.0", std::slice::from_ref(&release)).unwrap();
391 assert_eq!(asset.name, "rusty-teams-v0.5.0-linux-amd64");
438 assert_eq!(asset.name, "rusty-teams-0.5.0-linux-amd64");
392 439 }
393 440
394 441 #[test]
@@ -20,7 +20,18 @@ pub const CHECK_INTERVAL: Duration = Duration::from_secs(6 * 60 * 60);
20const RELEASES_URL: &str =
20const RELEASES_URL: &str =
21 "https://api.github.com/repos/danieldaeschle/rusty-teams/releases?per_page=10";
21 "https://api.github.com/repos/danieldaeschle/rusty-teams/releases?per_page=10";
22/// The release asset this platform installs, and the magic bytes it must start with.
22/// The release asset this platform installs, and the magic bytes it must start with.
23#[cfg(windows)]
23fn asset_suffix_for(os: &str, arch: &str) -> &'static str {
24 match (os, arch) {
25 ("windows", "aarch64") => "-windows-arm64.exe",
26 ("windows", _) => "-windows-amd64.exe",
27 ("linux", _) => "-linux-amd64",
28 _ => "-unsupported",
29 }
30}
31
32#[cfg(all(windows, target_arch = "aarch64"))]
33const ASSET_SUFFIX: &str = "-windows-arm64.exe";
34#[cfg(all(windows, not(target_arch = "aarch64")))]
24const ASSET_SUFFIX: &str = "-windows-amd64.exe";
35const ASSET_SUFFIX: &str = "-windows-amd64.exe";
25#[cfg(windows)]
36#[cfg(windows)]
26const EXECUTABLE_MAGIC: &[u8] = b"MZ";
37const EXECUTABLE_MAGIC: &[u8] = b"MZ";
@@ -303,13 +314,19 @@ mod tests {
303
314
304 use super::*;
315 use super::*;
305
316
317 /// Published asset name drops the leading `v` (`rusty-teams-0.5.0-windows-amd64.exe`).
318 fn asset_name(tag: &str) -> String {
319 let version = tag.strip_prefix('v').unwrap_or(tag);
320 format!("rusty-teams-{version}{ASSET_SUFFIX}")
321 }
322
306 fn release(tag: &str, prerelease: bool) -> Release {
323 fn release(tag: &str, prerelease: bool) -> Release {
307 Release {
324 Release {
308 tag_name: tag.to_owned(),
325 tag_name: tag.to_owned(),
309 draft: false,
326 draft: false,
310 prerelease,
327 prerelease,
311 assets: vec![ReleaseAsset {
328 assets: vec![ReleaseAsset {
312 name: format!("rusty-teams-{tag}{ASSET_SUFFIX}"),
329 name: asset_name(tag),
313 browser_download_url: format!("https://example.test/{tag}.exe"),
330 browser_download_url: format!("https://example.test/{tag}.exe"),
314 size: EXECUTABLE_MAGIC.len() as u64,
331 size: EXECUTABLE_MAGIC.len() as u64,
315 digest: None,
332 digest: None,
@@ -317,6 +334,36 @@ mod tests {
317 }
334 }
318 }
335 }
319
336
337 #[test]
338 fn windows_arm_and_amd64_look_for_different_exes() {
339 assert_eq!(asset_suffix_for("windows", "aarch64"), "-windows-arm64.exe");
340 assert_eq!(asset_suffix_for("windows", "x86_64"), "-windows-amd64.exe");
341 assert!(
342 !"rusty-teams-0.5.0-windows-amd64.exe"
343 .ends_with(asset_suffix_for("windows", "aarch64"))
344 );
345 assert!(
346 "rusty-teams-0.5.0-windows-arm64.exe".ends_with(asset_suffix_for("windows", "aarch64"))
347 );
348 }
349
350 #[test]
351 fn the_installed_suffix_matches_this_target() {
352 let os = if cfg!(windows) {
353 "windows"
354 } else if cfg!(target_os = "linux") {
355 "linux"
356 } else {
357 "other"
358 };
359 let arch = if cfg!(target_arch = "aarch64") {
360 "aarch64"
361 } else {
362 "x86_64"
363 };
364 assert_eq!(ASSET_SUFFIX, asset_suffix_for(os, arch));
365 }
366
320 #[test]
367 #[test]
321 fn versions_order_like_semver() {
368 fn versions_order_like_semver() {
322 let version = |tag| parse_version(tag).unwrap();
369 let version = |tag| parse_version(tag).unwrap();
@@ -381,14 +428,14 @@ mod tests {
381 let mut release = release("v0.5.0", false);
428 let mut release = release("v0.5.0", false);
382 let binary = release.assets.remove(0);
429 let binary = release.assets.remove(0);
383 let tarball = ReleaseAsset {
430 let tarball = ReleaseAsset {
384 name: "rusty-teams-v0.5.0-linux-amd64.tar.gz".to_owned(),
431 name: "rusty-teams-0.5.0-linux-amd64.tar.gz".to_owned(),
385 ..binary.clone()
432 ..binary.clone()
386 };
433 };
387 release.assets = vec![tarball.clone()];
434 release.assets = vec![tarball.clone()];
388 assert!(newest_update("v0.4.0", std::slice::from_ref(&release)).is_none());
435 assert!(newest_update("v0.4.0", std::slice::from_ref(&release)).is_none());
389 release.assets = vec![tarball, binary];
436 release.assets = vec![tarball, binary];
390 let (_, asset) = newest_update("v0.4.0", std::slice::from_ref(&release)).unwrap();
437 let (_, asset) = newest_update("v0.4.0", std::slice::from_ref(&release)).unwrap();
391 assert_eq!(asset.name, "rusty-teams-v0.5.0-linux-amd64");
438 assert_eq!(asset.name, "rusty-teams-0.5.0-linux-amd64");
392 }
439 }
393
440
394 #[test]
441 #[test]
docs/decisions/0014-linux-installs-and-updates-itself.md +1 −1
@@ -11,7 +11,7 @@ The Linux release is a bare binary in a tarball. Users had to copy a `.desktop`
11 11
12 12 ## Decision
13 13
14 On start the binary offers to install itself into `~/.local/share/rusty-teams/teams` and writes `~/.local/share/applications/rusty-teams.desktop` (`StartupWMClass=rusty-teams`, matching the window's app id). Build output from a cargo `target/` folder is copied, anything else is moved. "Don't ask again" can be undone in Settings > General, which also has Install, Replace and Remove. The installed copy updates itself from the same GitHub releases as Windows (`release_feed.rs`, `updater.rs`), but always with consent (`linux_update.rs`): when Settings > General > Automatic updates is on (the default), a newer release is offered in a dialog; Update downloads the `rusty-teams-<tag>-linux-amd64` asset with progress and checks size, ELF header and the SHA-256 digest GitHub reports; Restart now swaps the file and relaunches. Not now holds for the running session; the next start asks again. There is no idle restart and no install on quit on Linux: a download left for later is offered again on the next start (Restart now, no second download). Settings > General > Check now runs the same flow on demand. A build compares releases against its release tag, or against the workspace version (kept equal to the latest release) when built locally. Binaries outside the install folder never replace themselves; Settings > General still shows the switch and Check now and explains that the app has to be installed first.
14 On start the binary offers to install itself into `~/.local/share/rusty-teams/teams` and writes `~/.local/share/applications/rusty-teams.desktop` (`StartupWMClass=rusty-teams`, matching the window's app id). Build output from a cargo `target/` folder is copied, anything else is moved. "Don't ask again" can be undone in Settings > General, which also has Install, Replace and Remove. The installed copy updates itself from the same GitHub releases as Windows (`release_feed.rs`, `updater.rs`), but always with consent (`linux_update.rs`): when Settings > General > Automatic updates is on (the default), a newer release is offered in a dialog; Update downloads the `rusty-teams-<version>-linux-amd64` asset (the tag without a leading `v`) with progress and checks size, ELF header and the SHA-256 digest GitHub reports; Restart now swaps the file and relaunches. Not now holds for the running session; the next start asks again. There is no idle restart and no install on quit on Linux: a download left for later is offered again on the next start (Restart now, no second download). Settings > General > Check now runs the same flow on demand. A build compares releases against its release tag, or against the workspace version (kept equal to the latest release) when built locally. Binaries outside the install folder never replace themselves; Settings > General still shows the switch and Check now and explains that the app has to be installed first.
15 15
16 16 ## Consequences
17 17
@@ -11,7 +11,7 @@ The Linux release is a bare binary in a tarball. Users had to copy a `.desktop`
11
11
12## Decision
12## Decision
13
13
14On start the binary offers to install itself into `~/.local/share/rusty-teams/teams` and writes `~/.local/share/applications/rusty-teams.desktop` (`StartupWMClass=rusty-teams`, matching the window's app id). Build output from a cargo `target/` folder is copied, anything else is moved. "Don't ask again" can be undone in Settings > General, which also has Install, Replace and Remove. The installed copy updates itself from the same GitHub releases as Windows (`release_feed.rs`, `updater.rs`), but always with consent (`linux_update.rs`): when Settings > General > Automatic updates is on (the default), a newer release is offered in a dialog; Update downloads the `rusty-teams-<tag>-linux-amd64` asset with progress and checks size, ELF header and the SHA-256 digest GitHub reports; Restart now swaps the file and relaunches. Not now holds for the running session; the next start asks again. There is no idle restart and no install on quit on Linux: a download left for later is offered again on the next start (Restart now, no second download). Settings > General > Check now runs the same flow on demand. A build compares releases against its release tag, or against the workspace version (kept equal to the latest release) when built locally. Binaries outside the install folder never replace themselves; Settings > General still shows the switch and Check now and explains that the app has to be installed first.
14On start the binary offers to install itself into `~/.local/share/rusty-teams/teams` and writes `~/.local/share/applications/rusty-teams.desktop` (`StartupWMClass=rusty-teams`, matching the window's app id). Build output from a cargo `target/` folder is copied, anything else is moved. "Don't ask again" can be undone in Settings > General, which also has Install, Replace and Remove. The installed copy updates itself from the same GitHub releases as Windows (`release_feed.rs`, `updater.rs`), but always with consent (`linux_update.rs`): when Settings > General > Automatic updates is on (the default), a newer release is offered in a dialog; Update downloads the `rusty-teams-<version>-linux-amd64` asset (the tag without a leading `v`) with progress and checks size, ELF header and the SHA-256 digest GitHub reports; Restart now swaps the file and relaunches. Not now holds for the running session; the next start asks again. There is no idle restart and no install on quit on Linux: a download left for later is offered again on the next start (Restart now, no second download). Settings > General > Check now runs the same flow on demand. A build compares releases against its release tag, or against the workspace version (kept equal to the latest release) when built locally. Binaries outside the install folder never replace themselves; Settings > General still shows the switch and Check now and explains that the app has to be installed first.
15
15
16## Consequences
16## Consequences
17
17
packaging/linux/nfpm.yaml +30 −4
@@ -1,9 +1,9 @@
1 # .deb and .rpm packages (nfpm: https://nfpm.goreleaser.com). Run by package.sh, which stages
1 # .deb, .rpm and Arch packages (nfpm: https://nfpm.goreleaser.com). Run by package.sh, which stages
2 2 # the file tree, substitutes its path for ${STAGE} and the binary's glibc floor for ${GLIBC_MIN}
3 # (nfpm doesn't expand env vars in `src` or `depends`) and exports VERSION, NFPM_ARCH and
4 # RUSTY_TEAMS_MAINTAINER.
3 # (nfpm doesn't expand env vars in `src` or `depends`) and exports VERSION, NFPM_ARCH,
4 # NFPM_PACMAN_ARCH and RUSTY_TEAMS_MAINTAINER.
5 5 #
6 # packaging/linux/package.sh --formats "deb rpm"
6 # packaging/linux/package.sh --formats "deb rpm archlinux"
7 7 name: rusty-teams
8 8 arch: ${NFPM_ARCH}
9 9 platform: linux
@@ -92,6 +92,32 @@ overrides:
92 92 - libva.so.2()(64bit)
93 93 - libgbm.so.1()(64bit)
94 94 - xdg-desktop-portal
95 archlinux:
96 arch: ${NFPM_PACMAN_ARCH}
97 depends:
98 - glibc>=${GLIBC_MIN}
99 - gcc-libs
100 - glib2
101 - alsa-lib
102 - fontconfig
103 - freetype2
104 - libxcb
105 - libxkbcommon
106 - wayland
107 - libx11
108 - vulkan-icd-loader
109 - libglvnd
110 recommends:
111 - mesa
112 - libpulse
113 - pipewire
114 - libva
115 - xdg-desktop-portal
116 - libxcomposite
117 - libxdamage
118 - libxext
119 - libxfixes
120 - libxrandr
95 121
96 122 contents:
97 123 - src: ${STAGE}/usr/bin/teams
@@ -1,9 +1,9 @@
1# .deb and .rpm packages (nfpm: https://nfpm.goreleaser.com). Run by package.sh, which stages
1# .deb, .rpm and Arch packages (nfpm: https://nfpm.goreleaser.com). Run by package.sh, which stages
2# the file tree, substitutes its path for ${STAGE} and the binary's glibc floor for ${GLIBC_MIN}
2# the file tree, substitutes its path for ${STAGE} and the binary's glibc floor for ${GLIBC_MIN}
3# (nfpm doesn't expand env vars in `src` or `depends`) and exports VERSION, NFPM_ARCH and
3# (nfpm doesn't expand env vars in `src` or `depends`) and exports VERSION, NFPM_ARCH,
4# RUSTY_TEAMS_MAINTAINER.
4# NFPM_PACMAN_ARCH and RUSTY_TEAMS_MAINTAINER.
5#
5#
6# packaging/linux/package.sh --formats "deb rpm"
6# packaging/linux/package.sh --formats "deb rpm archlinux"
7name: rusty-teams
7name: rusty-teams
8arch: ${NFPM_ARCH}
8arch: ${NFPM_ARCH}
9platform: linux
9platform: linux
@@ -92,6 +92,32 @@ overrides:
92 - libva.so.2()(64bit)
92 - libva.so.2()(64bit)
93 - libgbm.so.1()(64bit)
93 - libgbm.so.1()(64bit)
94 - xdg-desktop-portal
94 - xdg-desktop-portal
95 archlinux:
96 arch: ${NFPM_PACMAN_ARCH}
97 depends:
98 - glibc>=${GLIBC_MIN}
99 - gcc-libs
100 - glib2
101 - alsa-lib
102 - fontconfig
103 - freetype2
104 - libxcb
105 - libxkbcommon
106 - wayland
107 - libx11
108 - vulkan-icd-loader
109 - libglvnd
110 recommends:
111 - mesa
112 - libpulse
113 - pipewire
114 - libva
115 - xdg-desktop-portal
116 - libxcomposite
117 - libxdamage
118 - libxext
119 - libxfixes
120 - libxrandr
95
121
96contents:
122contents:
97 - src: ${STAGE}/usr/bin/teams
123 - src: ${STAGE}/usr/bin/teams
packaging/linux/package.sh +12 −6
@@ -5,11 +5,12 @@
5 5 # $DIST/rusty-teams-<version>-linux-<arch>.AppImage.zsync delta updates (needs zsyncmake)
6 6 # $DIST/rusty-teams-<version>-linux-<arch>.deb Debian, Ubuntu, Mint, Pop!_OS, ...
7 7 # $DIST/rusty-teams-<version>-linux-<arch>.rpm Fedora, openSUSE, RHEL, ...
8 # $DIST/rusty-teams-<version>-linux-<arch>.pkg.tar.zst Arch Linux
8 9 # $DIST/rusty-teams-<version>-linux-<arch>.tar.gz plain FHS-style tree (bin/, share/)
9 10 #
10 # Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm tar"]
11 # Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm archlinux tar"]
11 12 #
12 # Needs: cargo and the Linux build setup from the README (clang 21+, mold); nfpm for deb/rpm
13 # Needs: cargo and the Linux build setup from the README (clang 21+, mold); nfpm for deb/rpm/Arch
13 14 # (https://nfpm.goreleaser.com); objdump (binutils). AppImage tooling is downloaded at verified
14 15 # pins into $CARGO_TARGET_DIR. Build on an old distro (CI: Ubuntu 22.04, glibc 2.35) so the
15 16 # binary runs on newer ones. Optional: desktop-file-validate, appstreamcli, zsyncmake (the zsync
@@ -28,12 +29,12 @@ DESKTOP_ID=rusty-teams
28 29 COMPONENT_ID=io.github.danieldaeschle.RustyTeams
29 30
30 31 SKIP_BUILD=0
31 FORMATS="appimage deb rpm tar"
32 FORMATS="appimage deb rpm archlinux tar"
32 33 while [[ $# -gt 0 ]]; do
33 34 case "$1" in
34 35 --skip-build) SKIP_BUILD=1; shift ;;
35 36 --formats) FORMATS="$2"; shift 2 ;;
36 -h | --help) sed -n '2,16p' "$0"; exit 0 ;;
37 -h | --help) sed -n '2,17p' "$0"; exit 0 ;;
37 38 *) echo "unknown argument: $1" >&2; exit 2 ;;
38 39 esac
39 40 done
@@ -93,17 +94,22 @@ if has tar; then
93 94 echo "wrote $DIST/$BASENAME.tar.gz"
94 95 fi
95 96
96 # ---- .deb / .rpm --------------------------------------------------------------------------------
97 if has deb || has rpm; then
97 # ---- .deb / .rpm / Arch -------------------------------------------------------------------------
98 if has deb || has rpm || has archlinux; then
98 99 command -v nfpm >/dev/null || { echo "error: nfpm not found (https://nfpm.goreleaser.com/install/)" >&2; exit 1; }
99 100 export VERSION
100 101 export NFPM_ARCH="$DEB_ARCH"
102 # pacman names the architecture x86_64/aarch64, not the Debian amd64/arm64.
103 export NFPM_PACMAN_ARCH="$ARCH"
101 104 # nfpm expands env vars in fields like `version` and `arch`, but not in `contents[].src` or
102 105 # the dependency lists.
103 106 sed -e "s|\${STAGE}|$STAGE|g" -e "s|\${GLIBC_MIN}|$GLIBC_MIN|g" "$HERE/nfpm.yaml" >"$WORK/nfpm.yaml"
104 107 for fmt in deb rpm; do
105 108 if has "$fmt"; then (cd "$ROOT" && nfpm package -f "$WORK/nfpm.yaml" -p "$fmt" -t "$DIST/$BASENAME.$fmt"); fi
106 109 done
110 if has archlinux; then
111 (cd "$ROOT" && nfpm package -f "$WORK/nfpm.yaml" -p archlinux -t "$DIST/$BASENAME.pkg.tar.zst")
112 fi
107 113 fi
108 114
109 115 # ---- AppImage -----------------------------------------------------------------------------------
@@ -5,11 +5,12 @@
5# $DIST/rusty-teams-<version>-linux-<arch>.AppImage.zsync delta updates (needs zsyncmake)
5# $DIST/rusty-teams-<version>-linux-<arch>.AppImage.zsync delta updates (needs zsyncmake)
6# $DIST/rusty-teams-<version>-linux-<arch>.deb Debian, Ubuntu, Mint, Pop!_OS, ...
6# $DIST/rusty-teams-<version>-linux-<arch>.deb Debian, Ubuntu, Mint, Pop!_OS, ...
7# $DIST/rusty-teams-<version>-linux-<arch>.rpm Fedora, openSUSE, RHEL, ...
7# $DIST/rusty-teams-<version>-linux-<arch>.rpm Fedora, openSUSE, RHEL, ...
8# $DIST/rusty-teams-<version>-linux-<arch>.pkg.tar.zst Arch Linux
8# $DIST/rusty-teams-<version>-linux-<arch>.tar.gz plain FHS-style tree (bin/, share/)
9# $DIST/rusty-teams-<version>-linux-<arch>.tar.gz plain FHS-style tree (bin/, share/)
9#
10#
10# Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm tar"]
11# Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm archlinux tar"]
11#
12#
12# Needs: cargo and the Linux build setup from the README (clang 21+, mold); nfpm for deb/rpm
13# Needs: cargo and the Linux build setup from the README (clang 21+, mold); nfpm for deb/rpm/Arch
13# (https://nfpm.goreleaser.com); objdump (binutils). AppImage tooling is downloaded at verified
14# (https://nfpm.goreleaser.com); objdump (binutils). AppImage tooling is downloaded at verified
14# pins into $CARGO_TARGET_DIR. Build on an old distro (CI: Ubuntu 22.04, glibc 2.35) so the
15# pins into $CARGO_TARGET_DIR. Build on an old distro (CI: Ubuntu 22.04, glibc 2.35) so the
15# binary runs on newer ones. Optional: desktop-file-validate, appstreamcli, zsyncmake (the zsync
16# binary runs on newer ones. Optional: desktop-file-validate, appstreamcli, zsyncmake (the zsync
@@ -28,12 +29,12 @@ DESKTOP_ID=rusty-teams
28COMPONENT_ID=io.github.danieldaeschle.RustyTeams
29COMPONENT_ID=io.github.danieldaeschle.RustyTeams
29
30
30SKIP_BUILD=0
31SKIP_BUILD=0
31FORMATS="appimage deb rpm tar"
32FORMATS="appimage deb rpm archlinux tar"
32while [[ $# -gt 0 ]]; do
33while [[ $# -gt 0 ]]; do
33 case "$1" in
34 case "$1" in
34 --skip-build) SKIP_BUILD=1; shift ;;
35 --skip-build) SKIP_BUILD=1; shift ;;
35 --formats) FORMATS="$2"; shift 2 ;;
36 --formats) FORMATS="$2"; shift 2 ;;
36 -h | --help) sed -n '2,16p' "$0"; exit 0 ;;
37 -h | --help) sed -n '2,17p' "$0"; exit 0 ;;
37 *) echo "unknown argument: $1" >&2; exit 2 ;;
38 *) echo "unknown argument: $1" >&2; exit 2 ;;
38 esac
39 esac
39done
40done
@@ -93,17 +94,22 @@ if has tar; then
93 echo "wrote $DIST/$BASENAME.tar.gz"
94 echo "wrote $DIST/$BASENAME.tar.gz"
94fi
95fi
95
96
96# ---- .deb / .rpm --------------------------------------------------------------------------------
97# ---- .deb / .rpm / Arch -------------------------------------------------------------------------
97if has deb || has rpm; then
98if has deb || has rpm || has archlinux; then
98 command -v nfpm >/dev/null || { echo "error: nfpm not found (https://nfpm.goreleaser.com/install/)" >&2; exit 1; }
99 command -v nfpm >/dev/null || { echo "error: nfpm not found (https://nfpm.goreleaser.com/install/)" >&2; exit 1; }
99 export VERSION
100 export VERSION
100 export NFPM_ARCH="$DEB_ARCH"
101 export NFPM_ARCH="$DEB_ARCH"
102 # pacman names the architecture x86_64/aarch64, not the Debian amd64/arm64.
103 export NFPM_PACMAN_ARCH="$ARCH"
101 # nfpm expands env vars in fields like `version` and `arch`, but not in `contents[].src` or
104 # nfpm expands env vars in fields like `version` and `arch`, but not in `contents[].src` or
102 # the dependency lists.
105 # the dependency lists.
103 sed -e "s|\${STAGE}|$STAGE|g" -e "s|\${GLIBC_MIN}|$GLIBC_MIN|g" "$HERE/nfpm.yaml" >"$WORK/nfpm.yaml"
106 sed -e "s|\${STAGE}|$STAGE|g" -e "s|\${GLIBC_MIN}|$GLIBC_MIN|g" "$HERE/nfpm.yaml" >"$WORK/nfpm.yaml"
104 for fmt in deb rpm; do
107 for fmt in deb rpm; do
105 if has "$fmt"; then (cd "$ROOT" && nfpm package -f "$WORK/nfpm.yaml" -p "$fmt" -t "$DIST/$BASENAME.$fmt"); fi
108 if has "$fmt"; then (cd "$ROOT" && nfpm package -f "$WORK/nfpm.yaml" -p "$fmt" -t "$DIST/$BASENAME.$fmt"); fi
106 done
109 done
110 if has archlinux; then
111 (cd "$ROOT" && nfpm package -f "$WORK/nfpm.yaml" -p archlinux -t "$DIST/$BASENAME.pkg.tar.zst")
112 fi
107fi
113fi
108
114
109# ---- AppImage -----------------------------------------------------------------------------------
115# ---- AppImage -----------------------------------------------------------------------------------