Skip to content

Commit 7ad4653

Browse files
authored
Merge pull request #12257 from gitbutlerapp/GB-1049/add-linux-installer
feat(but-installer): make installer compatible with Linux
2 parents 4d2a921 + 4ce46b4 commit 7ad4653

File tree

15 files changed

+871
-684
lines changed

15 files changed

+871
-684
lines changed

.github/workflows/publish.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ jobs:
6767
run: pnpm build:desktop -- --mode ${{ env.vitemode }}
6868
env:
6969
SENTRY_RELEASE: ${{ env.version }}
70-
- uses: actions/upload-artifact@v6
70+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
7171
name: Upload pnpm-store contents
7272
with:
7373
name: pnpm-store
7474
path: /home/runner/setup-pnpm/node_modules/.bin/store/v3
7575
retention-days: 7
76-
- uses: actions/upload-artifact@v6
76+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
7777
name: Upload SvelteKit build output
7878
with:
7979
name: sveltekit-build
@@ -232,7 +232,7 @@ jobs:
232232
echo "artifact_suffix=" >> $GITHUB_ENV
233233
fi
234234
- name: Upload Artifacts
235-
uses: actions/upload-artifact@v6
235+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
236236
with:
237237
name: '${{ env.channel }}-${{ matrix.platform }}${{ env.artifact_suffix }}-${{ github.run_number }}'
238238
path: release/
@@ -247,7 +247,7 @@ jobs:
247247
cp target/release/gitbutler-git-askpass.exe tauri-aux-artifacts/
248248
249249
- name: Upload Windows Aux Binary Artifacts
250-
uses: actions/upload-artifact@v6
250+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
251251
if: runner.os == 'Windows'
252252
with:
253253
name: '${{ env.channel }}-windows-aux-${{ github.run_number }}'
@@ -277,7 +277,7 @@ jobs:
277277
env:
278278
EVCODESIGND_PSK: ${{ secrets.EVCODESIGND_PSK }}
279279
- name: Upload signed artifacts
280-
uses: actions/upload-artifact@v6
280+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
281281
with:
282282
name: '${{ needs.build-tauri.outputs.channel }}-${{ matrix.platform }}-${{ github.run_number }}'
283283
path: release/
@@ -326,7 +326,7 @@ jobs:
326326
run: |
327327
Compress-Archive -Force -Path "release/${{ steps.set-path.outputs.msi_file }}" -DestinationPath "release/${{ steps.set-path.outputs.msi_file }}.zip"
328328
- name: Upload re-signed artifacts
329-
uses: actions/upload-artifact@v6
329+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
330330
with:
331331
name: '${{ needs.build-tauri.outputs.channel }}-${{ matrix.platform }}-${{ github.run_number }}'
332332
path: release/

.github/workflows/push.yaml

Lines changed: 106 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -264,56 +264,116 @@ jobs:
264264
- name: 'cargo check'
265265
run: cargo check --workspace --all-targets --features windows
266266

267-
build-installer-macos:
267+
build-installer:
268268
needs: changes
269269
if: ${{ needs.changes.outputs.but_installer == 'true' }}
270270
permissions:
271271
contents: read
272-
runs-on: macos-14
272+
strategy:
273+
fail-fast: false
274+
matrix:
275+
include:
276+
- platform: macos-15 # [macOs, ARM64] - default target
277+
artifact_id: macos-15-aarch64
278+
target: ''
279+
- platform: macos-15 # [macOs, x64] - cross-compile
280+
artifact_id: macos-15-x86_64
281+
target: x86_64-apple-darwin
282+
- platform: ubuntu-22.04 # [linux, x64]
283+
artifact_id: linux-x86_64
284+
target: ''
285+
- platform: ubuntu-22.04-arm # [linux, ARM64]
286+
artifact_id: linux-aarch64
287+
target: ''
288+
289+
runs-on: ${{ matrix.platform }}
290+
273291
env:
274292
CARGO_TERM_COLOR: always
275293
steps:
276294
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
277295
with:
278296
persist-credentials: false
279-
- name: Install Rust targets
297+
- name: Set Cargo build target to ${{ matrix.target }}
298+
shell: bash
299+
if: matrix.target != ''
280300
run: |
281-
rustup target add x86_64-apple-darwin
282-
rustup target add aarch64-apple-darwin
301+
echo "CARGO_BUILD_TARGET=${{ matrix.target }}" >> $GITHUB_ENV
302+
rustup target add ${{ matrix.target }}
283303
- name: Rust Cache
284304
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
285305
with:
286-
shared-key: installer-macos
306+
shared-key: installer
287307
save-if: ${{ github.ref == 'refs/heads/master' }}
288308
- name: Build installer for x86_64
289-
run: cargo build --release -p but-installer --target x86_64-apple-darwin
290-
- name: Build installer for aarch64
291-
run: cargo build --release -p but-installer --target aarch64-apple-darwin
309+
run: cargo build --release -p but-installer
292310
- name: Verify binaries
293311
run: |
294-
test -x target/x86_64-apple-darwin/release/but-installer
295-
test -x target/aarch64-apple-darwin/release/but-installer
296-
echo "x86_64 binary:"
297-
file target/x86_64-apple-darwin/release/but-installer
298-
echo "aarch64 binary:"
299-
file target/aarch64-apple-darwin/release/but-installer
300-
- name: Upload x86_64 installer artifact
312+
test -x target/${{matrix.target}}/release/but-installer
313+
file target/${{matrix.target}}/release/but-installer
314+
- name: Upload Artifacts
301315
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
302316
with:
303-
name: 'but-installer-darwin-x86_64-${{ github.run_number }}'
304-
path: target/x86_64-apple-darwin/release/but-installer
305-
retention-days: 7
317+
name: 'but-installer-${{ matrix.artifact_id }}-${{ github.run_number }}'
318+
path: target/${{matrix.target}}/release/but-installer
306319
if-no-files-found: error
307-
- name: Upload aarch64 installer artifact
308-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
309-
with:
310-
name: 'but-installer-darwin-aarch64-${{ github.run_number }}'
311-
path: target/aarch64-apple-darwin/release/but-installer
312320
retention-days: 7
313-
if-no-files-found: error
321+
322+
fetch-published-versions:
323+
needs: build-installer
324+
runs-on: ubuntu-22.04
325+
permissions:
326+
contents: none
327+
outputs:
328+
release_version: ${{ steps.fetch.outputs.release_version }}
329+
nightly_version: ${{ steps.fetch.outputs.nightly_version }}
330+
steps:
331+
- name: Fetch latest release and nightly versions
332+
id: fetch
333+
run: |
334+
echo "release_version=$(curl -s https://app.gitbutler.com/releases | jq -r .version)" >> $GITHUB_OUTPUT
335+
echo "nightly_version=$(curl -s https://app.gitbutler.com/releases/nightly | jq -r .version)" >> $GITHUB_OUTPUT
336+
337+
validate-installer:
338+
needs:
339+
- build-installer
340+
- fetch-published-versions
341+
permissions:
342+
contents: none
343+
env:
344+
LATEST_RELEASE_VERSION: ${{ needs.fetch-published-versions.outputs.release_version }}
345+
LATEST_NIGHTLY_VERSION: ${{ needs.fetch-published-versions.outputs.nightly_version }}
346+
strategy:
347+
fail-fast: false
348+
matrix:
349+
include:
350+
- platform: macos-15 # [macOs, ARM64] - default target
351+
artifact_id: macos-15-aarch64
352+
- platform: macos-15 # [macOs, x64] - cross-compile
353+
artifact_id: macos-15-x86_64
354+
- platform: ubuntu-22.04 # [linux, x64]
355+
artifact_id: linux-x86_64
356+
- platform: ubuntu-22.04-arm # [linux, ARM64]
357+
artifact_id: linux-aarch64
358+
runs-on: ${{ matrix.platform }}
359+
steps:
360+
- name: Download ${{ matrix.artifact_id }} installer
361+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
362+
with:
363+
name: 'but-installer-${{ matrix.artifact_id }}-${{ github.run_number }}'
364+
path: .
365+
- run: chmod +x ./but-installer
366+
- name: Install release
367+
run: ./but-installer
368+
- name: Validate release version
369+
run: but --version | grep "but $LATEST_RELEASE_VERSION"
370+
- name: Install nightly
371+
run: ./but-installer nightly
372+
- name: Validate nightly version
373+
run: but --version | grep "but $LATEST_NIGHTLY_VERSION"
314374

315375
publish-installer:
316-
needs: build-installer-macos
376+
needs: build-installer
317377
if: ${{ github.ref == 'refs/heads/master' }}
318378
runs-on: ubuntu-latest
319379
permissions:
@@ -322,23 +382,29 @@ jobs:
322382
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
323383
with:
324384
persist-credentials: false
325-
- name: Download x86_64 installer
385+
- name: Download macOS x86_64 installer
386+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
387+
with:
388+
name: 'but-installer-macos-15-x86_64-${{ github.run_number }}'
389+
path: s3-upload/macos/x86_64
390+
- name: Download macOS aarch64 installer
391+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
392+
with:
393+
name: 'but-installer-macos-15-aarch64-${{ github.run_number }}'
394+
path: s3-upload/macos/aarch64
395+
- name: Download Linux x86_64 installer
326396
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
327397
with:
328-
name: 'but-installer-darwin-x86_64-${{ github.run_number }}'
329-
path: installer-artifacts/darwin-x86_64
330-
- name: Download aarch64 installer
398+
name: 'but-installer-linux-x86_64-${{ github.run_number }}'
399+
path: s3-upload/linux/x86_64
400+
- name: Download Linux aarch64 installer
331401
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
332402
with:
333-
name: 'but-installer-darwin-aarch64-${{ github.run_number }}'
334-
path: installer-artifacts/darwin-aarch64
335-
- name: Prepare S3 payload
403+
name: 'but-installer-linux-aarch64-${{ github.run_number }}'
404+
path: s3-upload/linux/aarch64
405+
- name: Make binaries executable
336406
run: |
337-
mkdir -p s3-upload/macos/x86_64
338-
mkdir -p s3-upload/macos/aarch64
339-
cp installer-artifacts/darwin-x86_64/but-installer s3-upload/macos/x86_64/but-installer
340-
cp installer-artifacts/darwin-aarch64/but-installer s3-upload/macos/aarch64/but-installer
341-
chmod +x s3-upload/macos/*/but-installer
407+
find ./s3-upload -name 'but-installer' | xargs chmod +x
342408
- name: Upload to S3
343409
uses: shallwefootball/s3-upload-action@4350529f410221787ccf424e50133cbc1b52704e # master
344410
with:
@@ -365,7 +431,7 @@ jobs:
365431
- rust-test-tauri
366432
- rust-lint
367433
- cargo-doc
368-
- build-installer-macos
434+
- build-installer
369435
runs-on: ubuntu-latest
370436
env:
371437
CARGO_TERM_COLOR: always
@@ -431,7 +497,7 @@ jobs:
431497
- name: run playwright tests
432498
run: pnpm exec turbo run test:ct
433499
if: ${{ github.ref != 'refs/heads/master' }}
434-
- uses: actions/upload-artifact@v6
500+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
435501
if: ${{ !cancelled() }}
436502
with:
437503
name: playwright-report

.github/workflows/test-e2e-blackbox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
if: ${{ github.ref != 'refs/heads/master' }}
6565
run: xvfb-run pnpm test:e2e:blackbox
6666

67-
- uses: actions/upload-artifact@v6
67+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
6868
if: failure()
6969
with:
7070
name: WebdriverIO Artifacts

.github/workflows/test-e2e-playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
- name: Run Playwright tests
7777
run: pnpm exec turbo run test:e2e:playwright
7878
if: ${{ github.ref != 'refs/heads/master' }}
79-
- uses: actions/upload-artifact@v6
79+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
8080
if: ${{ !cancelled() }}
8181
with:
8282
name: playwright-report

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/but-installer/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,7 @@ base64 = "0.22.1"
4040
[target.'cfg(target_os = "macos")'.dependencies]
4141
# For removing quarantine attribute on macOS
4242
xattr = "1.6.1"
43+
44+
[target.'cfg(target_os = "linux")'.dependencies]
45+
# I couldn't make it work without the ssl feature enabled, it doesn't dynamically link to libssl without it so https just doesn't work
46+
curl = { version = "0.4.49", default-features = false, features = ["ssl"] }

crates/but-installer/src/config.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,12 @@ impl InstallerConfig {
150150
let os = env::consts::OS;
151151
let arch = env::consts::ARCH;
152152

153-
if os != "macos" {
154-
bail!("This installer currently only supports macOS. Your OS: {}", os);
155-
}
156-
157-
let platform = match arch {
158-
"x86_64" => "darwin-x86_64",
159-
"aarch64" => "darwin-aarch64",
160-
_ => bail!("Unsupported architecture: {}", arch),
153+
let platform = match (os, arch) {
154+
("macos", "aarch64") => "darwin-aarch64",
155+
("macos", "x86_64") => "darwin-x86_64",
156+
("linux", "aarch64") => "linux-aarch64",
157+
("linux", "x86_64") => "linux-x86_64",
158+
(os, arch) => bail!("unsupported OS or architecture: {os} {arch}"),
161159
};
162160

163161
Ok(Self {

0 commit comments

Comments
 (0)