Skip to content

Commit 59237e8

Browse files
committed
ios
1 parent 2c39364 commit 59237e8

4 files changed

Lines changed: 99 additions & 41 deletions

File tree

.github/workflows/ios.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: ios
2+
3+
# Builds an UNSIGNED .ipa for sideloading.
4+
#
5+
# Unsigned on purpose. `tauri ios build` has no no-sign option and wants a
6+
# signing identity and a team, which would mean an Apple account and
7+
# certificates in secrets. Sideload tools (AltStore, SideStore, Sideloadly)
8+
# re-sign the payload themselves, so a signed artifact from CI would only be
9+
# thrown away. That is why this drops to xcodebuild instead of the Tauri CLI for
10+
# the archive step.
11+
#
12+
# Manual for now: nothing here has ever run, and the generated Xcode project's
13+
# names are discovered rather than assumed. Once a run succeeds, fold it into
14+
# build.yml so it ships with the other installers.
15+
on:
16+
workflow_dispatch:
17+
18+
jobs:
19+
ipa:
20+
runs-on: macos-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- uses: dtolnay/rust-toolchain@stable
25+
with:
26+
targets: aarch64-apple-ios
27+
28+
- uses: Swatinem/rust-cache@v2
29+
30+
- name: tauri cli
31+
run: cargo install tauri-cli --version "^2" --locked
32+
33+
- name: icons
34+
run: cargo tauri icon icon-source.png --ios-color '#c8901f'
35+
36+
# Generates gen/apple/. --ci keeps it from prompting.
37+
- name: scaffold xcode project
38+
run: cargo tauri ios init --ci
39+
40+
# The scheme and project names depend on how Tauri derives them from the
41+
# crate, so read them rather than guess. This step is also the log to look
42+
# at when something below cannot find a path.
43+
- name: discover project
44+
id: xc
45+
run: |
46+
set -eux
47+
ls -la gen/apple
48+
proj=$(find gen/apple -maxdepth 1 -name '*.xcodeproj' | head -1)
49+
echo "proj=$proj" >> "$GITHUB_OUTPUT"
50+
xcodebuild -project "$proj" -list
51+
scheme=$(xcodebuild -project "$proj" -list -json \
52+
| python3 -c 'import json,sys; s=json.load(sys.stdin)["project"]["schemes"]; print(next((x for x in s if "iOS" in x), s[0]))')
53+
echo "scheme=$scheme" >> "$GITHUB_OUTPUT"
54+
55+
- name: archive (unsigned)
56+
run: |
57+
set -eux
58+
xcodebuild archive \
59+
-project "${{ steps.xc.outputs.proj }}" \
60+
-scheme "${{ steps.xc.outputs.scheme }}" \
61+
-configuration release \
62+
-sdk iphoneos \
63+
-archivePath "$PWD/build/pixity.xcarchive" \
64+
-destination 'generic/platform=iOS' \
65+
CODE_SIGNING_ALLOWED=NO \
66+
CODE_SIGNING_REQUIRED=NO \
67+
CODE_SIGN_IDENTITY="" \
68+
CODE_SIGN_ENTITLEMENTS="" \
69+
DEVELOPMENT_TEAM=""
70+
71+
# An .ipa is a zip with the .app inside a top-level Payload/ directory and
72+
# nothing else. Signing is the only thing this is missing.
73+
- name: package ipa
74+
run: |
75+
set -eux
76+
app=$(find build/pixity.xcarchive/Products/Applications -maxdepth 1 -name '*.app' | head -1)
77+
test -n "$app"
78+
rm -rf Payload && mkdir Payload
79+
cp -R "$app" Payload/
80+
zip -qry pixity-unsigned.ipa Payload
81+
ls -lh pixity-unsigned.ipa
82+
83+
- uses: actions/upload-artifact@v4
84+
with:
85+
name: ios-unsigned-ipa
86+
path: pixity-unsigned.ipa
87+
if-no-files-found: error

Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@ description = "pixity.dev as a desktop app"
66
license = "GPL-3.0"
77
rust-version = "1.77"
88

9+
[lib]
10+
name = "pixity_desktop_lib"
11+
crate-type = ["staticlib", "cdylib", "rlib"]
12+
913
[build-dependencies]
1014
tauri-build = { version = "2", features = [] }
1115

1216
[dependencies]
13-
tauri = { version = "2", features = ["tray-icon"] }
17+
tauri = { version = "2" }
1418
tauri-plugin-notification = "2"
1519
tauri-plugin-opener = "2"
16-
tauri-plugin-single-instance = "2"
1720
serde = { version = "1", features = ["derive"] }
1821
serde_json = "1"
1922

23+
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
24+
tauri-plugin-single-instance = "2"
25+
2026
[profile.release]
2127
opt-level = "s"
2228
lto = true

src/main.rs

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,5 @@
11
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
22

3-
mod badge;
4-
mod bridge;
5-
mod notify;
6-
mod share;
7-
8-
use tauri::{Manager, WindowEvent};
9-
103
fn main() {
11-
tauri::Builder::default()
12-
.plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| {
13-
if let Some(win) = app.get_webview_window("main") {
14-
let _ = win.unminimize();
15-
let _ = win.show();
16-
let _ = win.set_focus();
17-
}
18-
}))
19-
.plugin(tauri_plugin_notification::init())
20-
.plugin(tauri_plugin_opener::init())
21-
.setup(|app| {
22-
notify::init(app.handle());
23-
share::init(app.handle());
24-
Ok(())
25-
})
26-
.on_window_event(|win, event| {
27-
if let WindowEvent::CloseRequested { .. } = event {
28-
win.app_handle().exit(0);
29-
}
30-
})
31-
.invoke_handler(tauri::generate_handler![
32-
bridge::native_info,
33-
bridge::notify_show,
34-
bridge::notify_close,
35-
bridge::badge_set,
36-
bridge::share_probe,
37-
bridge::share_start,
38-
bridge::share_stop,
39-
bridge::share_signal_in,
40-
])
41-
.run(tauri::generate_context!())
42-
.expect("pixity: failed to start");
4+
pixity_desktop_lib::run()
435
}

tauri.conf.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
"minimumSystemVersion": "13.0",
4646
"entitlements": "entitlements.plist"
4747
},
48+
"iOS": {
49+
"minimumSystemVersion": "14.0"
50+
},
4851
"linux": {
4952
"deb": {
5053
"depends": ["libwebkit2gtk-4.1-0", "libpipewire-0.3-0"]

0 commit comments

Comments
 (0)