Skip to content

Commit a20a77a

Browse files
committed
chore: enable building x86_64-apple-darwin in release pipeline
1 parent f39d14f commit a20a77a

File tree

4 files changed

+98
-38
lines changed

4 files changed

+98
-38
lines changed

.github/workflows/draft-release.yml

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ jobs:
1717
matrix:
1818
include:
1919
- args: "aarch64-apple-darwin"
20-
arch: "silicon"
21-
# - args: "x86_64-apple-darwin"
22-
# arch: "intel"
20+
- args: "x86_64-apple-darwin"
2321
env:
2422
APPLE_ID: ${{ secrets.APPLE_ID }}
2523
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
@@ -31,8 +29,12 @@ jobs:
3129
steps:
3230
- name: Checkout project
3331
uses: actions/checkout@v4
32+
with:
33+
ssh-key: ${{ secrets.TEMP_SSH_KEY }}
34+
submodules: recursive
3435

3536
- name: Import signing certificate into keychain
37+
if: ${{ runner.os }} == 'macOS'
3638
uses: apple-actions/import-codesign-certs@v3
3739
with:
3840
p12-file-base64: ${{ secrets.SIGNING_CERTIFICATE_P12_DATA }}
@@ -50,6 +52,22 @@ jobs:
5052
targets: ${{ matrix.args }}
5153
components: rust-src, rustfmt, clippy
5254

55+
- name: Install target
56+
run: |
57+
rustup target add ${{ matrix.args }}
58+
59+
- name: Setup Python
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: "^3.13"
63+
64+
- name: Setup Go
65+
uses: actions/setup-go@v5
66+
with:
67+
cache: true
68+
go-version-file: src-syftbox/go.mod
69+
cache-dependency-path: src-syftbox/go.sum
70+
5371
- name: Cache Bun dependencies
5472
uses: actions/cache@v4
5573
with:
@@ -78,8 +96,16 @@ jobs:
7896
run: bun install --cwd src-frontend
7997

8098
- name: Build app
99+
if: ${{ runner.os }} == 'macOS'
81100
run: |
82-
GITHUB_CI=1 just package
101+
GITHUB_CI=1 just package TARGET_TRIPLE=${{ matrix.args }}
102+
103+
# Move the artifacts to the artifacts directory
104+
mkdir -p artifacts
105+
mv src-tauri/target/release/bundle/dmg/*.dmg artifacts/SyftBox-${{ matrix.args }}.dmg
106+
mv src-tauri/target/release/bundle/macos/*.app artifacts/SyftBox-${{ matrix.args }}.app
107+
mv src-tauri/target/release/bundle/macos/*.app.tar.gz artifacts/SyftBox-${{ matrix.args }}.app.tar.gz
108+
mv src-tauri/target/release/bundle/macos/*.app.tar.gz.sig artifacts/SyftBox-${{ matrix.args }}.app.tar.gz.sig
83109
84110
- name: Setup git config
85111
env:
@@ -100,21 +126,18 @@ jobs:
100126
# run: just deploy-frontend-to-stage
101127

102128
- name: Create release
103-
uses: softprops/action-gh-release@v2
129+
uses: ncipollo/release-action@v1
104130
with:
105-
tag_name: ${{ inputs.version }}
131+
tag: ${{ inputs.version }}
106132
name: ${{ inputs.version }}
107133
draft: true
108-
generate_release_notes: true
109-
make_latest: true
110-
files: |
111-
./src-tauri/target/release/bundle/dmg/*.dmg
112-
./src-tauri/target/release/bundle/macos/*.app
113-
./src-tauri/target/release/bundle/macos/*.app.tar.gz
114-
./src-tauri/target/release/bundle/macos/*.app.tar.gz.sig
134+
allowUpdates: true
135+
generateReleaseNotes: true
136+
makeLatest: true
137+
artifacts: ./artifacts/*.dmg,./artifacts/*.app,./artifacts/*.app.tar.gz,./artifacts/*.app.tar.gz.sig
115138

116139
- name: Clean up all user keychains
117-
if: always()
140+
if: always() && ${{ runner.os }} == 'macOS'
118141
run: |
119142
# List all keychains
120143
keychains=$(security list-keychains | tr -d '" "')

.github/workflows/publish-release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ jobs:
2828
"pub_date": "${{ github.event.release.published_at }}",
2929
"platforms": {
3030
"darwin-aarch64": {
31-
"signature": "$(curl -fsSL $(gh release view ${{ github.event.release.tag_name }} --json assets --jq '.assets[] | select(.name=="SyftBox.app.tar.gz.sig") | .url'))",
32-
"url": "$(gh release view ${{ github.event.release.tag_name }} --json assets --jq '.assets[] | select(.name=="SyftBox.app.tar.gz") | .url')"
31+
"signature": "$(curl -fsSL $(gh release view ${{ github.event.release.tag_name }} --json assets --jq '.assets[] | select(.name=="SyftBox-aarch64-apple-darwin.app.tar.gz.sig") | .url'))",
32+
"url": "$(gh release view ${{ github.event.release.tag_name }} --json assets --jq '.assets[] | select(.name=="SyftBox-aarch64-apple-darwin.app.tar.gz") | .url')"
33+
},
34+
"darwin-x86_64": {
35+
"signature": "$(curl -fsSL $(gh release view ${{ github.event.release.tag_name }} --json assets --jq '.assets[] | select(.name=="SyftBox-x86_64-apple-darwin.app.tar.gz.sig") | .url'))",
36+
"url": "$(gh release view ${{ github.event.release.tag_name }} --json assets --jq '.assets[] | select(.name=="SyftBox-x86_64-apple-darwin.app.tar.gz") | .url')"
3337
}
3438
}
3539
}

justfile

Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -240,21 +240,21 @@ dev-frontend:
240240

241241
# Build the frontend, bridge and desktop app and package them into a single installable.
242242
[group('package')]
243-
package:
243+
package TARGET_TRIPLE="":
244244
#!/usr/bin/env python
245245
import subprocess
246246
import sys
247247

248248
try:
249249
subprocess.run(["just", "package-frontend", "desktop_build=yes"], check=True)
250-
subprocess.run(["just", "package-bridge"], check=True)
251-
subprocess.run(["just", "package-desktop"], check=True)
250+
subprocess.run(["just", "package-bridge", "{{ TARGET_TRIPLE }}"], check=True)
251+
subprocess.run(["just", "package-desktop", "{{ TARGET_TRIPLE }}"], check=True)
252252
except subprocess.CalledProcessError as e:
253253
sys.exit(e.returncode)
254254

255255
# Build the bridge and package it into a single installable.
256256
[group('package')]
257-
package-bridge:
257+
package-bridge TARGET_TRIPLE="":
258258
#!/usr/bin/env python
259259
import os
260260
import platform
@@ -264,21 +264,29 @@ package-bridge:
264264
from pathlib import Path
265265

266266
try:
267-
# Run the build command
268-
subprocess.run(['just', '--justfile=src-syftbox/justfile', 'build-client-target'], check=True)
269-
270-
# Get target triple
271-
rustc_output = subprocess.run(['rustc', '-Vv'], capture_output=True, text=True).stdout
272-
target_triple = None
273-
for line in rustc_output.splitlines():
274-
if 'host:' in line:
275-
target_triple = line.split('host:')[1].strip()
276-
break
267+
target_triple = "{{ TARGET_TRIPLE }}"
268+
if not target_triple:
269+
# Get target triple
270+
rustc_output = subprocess.run(['rustc', '-Vv'], capture_output=True, text=True).stdout
271+
target_triple = None
272+
for line in rustc_output.splitlines():
273+
if 'host:' in line:
274+
target_triple = line.split('host:')[1].strip()
275+
break
277276

278277
if not target_triple:
279278
print(f"{{ _red }}Failed to determine the target triple. Please check the Rust installation.{{ _nc }}")
280279
sys.exit(1)
281280

281+
# Run the build command
282+
if target_triple == "aarch64-apple-darwin":
283+
subprocess.run(['just', '--justfile=src-syftbox/justfile', 'build-client-target', 'darwin', 'arm64'], check=True)
284+
elif target_triple == "x86_64-apple-darwin":
285+
subprocess.run(['just', '--justfile=src-syftbox/justfile', 'build-client-target', 'darwin', 'amd64'], check=True)
286+
else:
287+
# The command will automatically determine the target triple
288+
subprocess.run(['just', '--justfile=src-syftbox/justfile', 'build-client-target'], check=True)
289+
282290
# Determine extension
283291
extension = '.exe' if platform.system() == 'Windows' else ''
284292

@@ -293,26 +301,37 @@ package-bridge:
293301
print(f"{{ _red }}No client binary found in src-syftbox/.out{{ _nc }}")
294302
sys.exit(1)
295303

296-
for client_file in client_files:
297-
shutil.copy2(client_file, dst)
304+
shutil.copy2(client_files[0], dst)
298305
except subprocess.CalledProcessError as e:
299306
sys.exit(e.returncode)
300307

301308
# Build the desktop app and package it into a single installable.
302309
[group('package')]
303-
package-desktop:
310+
package-desktop TARGET_TRIPLE="":
304311
#!/usr/bin/env python
305312
import os
306313
import subprocess
307314
import sys
308315

309316
env = os.environ.copy()
317+
target_triple = "{{ TARGET_TRIPLE }}"
318+
if not target_triple:
319+
# Get target triple
320+
rustc_output = subprocess.run(['rustc', '-Vv'], capture_output=True, text=True).stdout
321+
for line in rustc_output.splitlines():
322+
if 'host:' in line:
323+
target_triple = line.split('host:')[1].strip()
324+
break
325+
326+
if not target_triple:
327+
print(f"{{ _red }}Failed to determine the target triple. Please check the Rust installation.{{ _nc }}")
328+
sys.exit(1)
310329

311330
try:
312331
if env.get('GITHUB_CI') == '1':
313332
env['CI'] = 'false'
314333
env['TAURI_BUNDLER_DMG_IGNORE_CI'] = 'true'
315-
subprocess.run(['bunx', '@tauri-apps/cli', 'build'], env=env, check=True)
334+
subprocess.run(['bunx', '@tauri-apps/cli', 'build', "--ci", "--target", target_triple], env=env, check=True)
316335
else:
317336
env['TAURI_SIGNING_PRIVATE_KEY'] = 'dummy'
318337
env['TAURI_SIGNING_PRIVATE_KEY_PASSWORD'] = 'dummy'
@@ -409,13 +428,26 @@ deploy-frontend-to-stage:
409428

410429
# Update version numbers
411430
[group('utils')]
412-
update-version:
431+
update-version TARGET_TRIPLE="":
413432
#!/usr/bin/env python
414433
import json
415434
import re
416435
import subprocess
417436
from pathlib import Path
418437

438+
target_triple = "{{ TARGET_TRIPLE }}"
439+
if not target_triple:
440+
# Get target triple
441+
rustc_output = subprocess.run(['rustc', '-Vv'], capture_output=True, text=True).stdout
442+
for line in rustc_output.splitlines():
443+
if 'host:' in line:
444+
target_triple = line.split('host:')[1].strip()
445+
break
446+
447+
if not target_triple:
448+
print(f"{{ _red }}Failed to determine the target triple. Please check the Rust installation.{{ _nc }}")
449+
sys.exit(1)
450+
419451
# Get versions
420452
with open('src-frontend/package.json') as f:
421453
frontend_version = json.load(f)['version']
@@ -424,7 +456,7 @@ update-version:
424456
desktop_version = json.load(f)['version']
425457

426458
# Find and get daemon version
427-
daemon_path = next(Path('src-tauri/target/binaries').glob('syftbox_client*'))
459+
daemon_path = next(Path('src-tauri/binaries').glob(f'syftbox_client-{target_triple}*'))
428460
daemon_output = subprocess.run([str(daemon_path), '--version'], capture_output=True, text=True).stdout
429461
daemon_version = re.search(r'version ([0-9]+\.[0-9]+\.[0-9]+(?:-[a-zA-Z0-9]+)*)', daemon_output).group(1)
430462

@@ -572,7 +604,8 @@ setup skip_prerequisites="no":
572604
# Try common locations
573605
home = str(Path.home())
574606
possible_paths = [
575-
os.path.join(home, '.bun', 'bin', 'bun'),
607+
os.path.join(home, '.bun', 'bin', 'bun'), # Unix
608+
os.path.join(home, '.bun', 'bin', 'bun.exe'), # Windows
576609
os.path.join(home, 'AppData', 'Local', 'bun', 'bun.exe') # Windows
577610
]
578611

src-frontend/lib/analytics/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function AnalyticsProvider({
4343
}) {
4444
// If we want to replace Aptabase in the future, we'd modify this component
4545
return (
46-
<AptabaseProvider appKey={appKey}>
46+
<AptabaseProvider appKey={appKey} options={{ appVersion: "0.1.6" }}>
4747
<AnalyticsConsumer>{children}</AnalyticsConsumer>
4848
</AptabaseProvider>
4949
);

0 commit comments

Comments
 (0)