Skip to content

Commit 95c4483

Browse files
committed
improve actions
1 parent ebda811 commit 95c4483

5 files changed

Lines changed: 162 additions & 94 deletions

File tree

.github/workflows/build.yml

Lines changed: 116 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ on:
44
branches:
55
- main
66
workflow_dispatch:
7-
release:
8-
types: [published]
7+
8+
env:
9+
BINARY_NAME: plumeimpactor
10+
BUNDLE_NAME: Impactor
911

1012
jobs:
1113
build-linux:
@@ -21,36 +23,36 @@ jobs:
2123
target
2224
key: linux-cargo-${{ hashFiles('**/Cargo.lock') }}
2325
restore-keys: linux-cargo-
24-
26+
2527
- name: Install Rust stable
2628
uses: dtolnay/rust-toolchain@stable
27-
29+
2830
- name: Install Linux dependencies
2931
run: |
3032
sudo apt-get update
3133
sudo apt-get install libgtk-3-dev libpng-dev libjpeg-dev libgl1-mesa-dev libglu1-mesa-dev libxkbcommon-dev libexpat1-dev libtiff-dev
32-
34+
3335
- name: Build Dependencies
3436
run: |
3537
cargo install patch-crate
3638
cargo fetch --locked || true
3739
cargo patch-crate --force
3840
cargo install cargo-bundle
3941
mkdir -p build/out
40-
42+
4143
- name: Build & Bundle (Linux)
4244
run: |
43-
cargo bundle --bin plumeimpactor --package plumeimpactor --release --format appimage
45+
cargo bundle --bin ${{ env.BINARY_NAME }} --package ${{ env.BINARY_NAME }} --release --format appimage
4446
cp -R target/release/bundle/appimage/*.AppImage build/out/
45-
47+
4648
- name: Upload Bundles
4749
uses: actions/upload-artifact@v4
4850
with:
49-
name: plumeimpactor-linux
51+
name: ${{ env.BINARY_NAME }}-linux
5052
path: build/out/*
5153

52-
build-macos:
53-
runs-on: macos-latest
54+
build-windows:
55+
runs-on: windows-latest
5456
steps:
5557
- uses: actions/checkout@v4
5658
- name: Cache Rust dependencies
@@ -60,47 +62,38 @@ jobs:
6062
~/.cargo/registry
6163
~/.cargo/git
6264
target
63-
key: macos-cargo-${{ hashFiles('**/Cargo.lock') }}
64-
restore-keys: macos-cargo-
65-
65+
key: windows-cargo-${{ hashFiles('**/Cargo.lock') }}
66+
restore-keys: windows-cargo-
67+
6668
- name: Install Rust stable
6769
uses: dtolnay/rust-toolchain@stable
68-
with:
69-
targets: aarch64-apple-darwin
70-
71-
- name: Setup macOS Certificates
72-
uses: apple-actions/import-codesign-certs@v5
73-
with:
74-
p12-file-base64: ${{ secrets.DEV_ID_P12_BASE64 }}
75-
p12-password: ${{ secrets.DEV_ID_P12_PASSWORD }}
76-
70+
71+
- name: Setup Windows dependencies
72+
run: choco install strawberryperl make --no-progress
73+
74+
- name: Setup Windows MSVC environment
75+
uses: ilammy/msvc-dev-cmd@v1
76+
7777
- name: Build Dependencies
7878
run: |
7979
cargo install patch-crate
8080
cargo fetch --locked || true
8181
cargo patch-crate --force
82-
cargo install cargo-bundle
8382
mkdir -p build/out
84-
mkdir -p build/dmg
85-
86-
- name: Build & Bundle (macOS)
83+
84+
- name: Build & Bundle (Windows)
8785
run: |
88-
cargo bundle --bin plumeimpactor --package plumeimpactor --release --format osx
89-
cp -R target/release/bundle/osx/plumeimpactor.app build/dmg/plumeimpactor.app
90-
codesign --deep --force --options runtime --sign "${{ secrets.DEV_ID_IDENTITY_NAME }}" build/dmg/plumeimpactor.app
91-
ln -s /Applications build/dmg/Applications
92-
hdiutil create -volname plumeimpactor -srcfolder build/dmg -ov -format UDZO build/out/PlumeImpactor.dmg
93-
xcrun notarytool submit build/out/PlumeImpactor.dmg --apple-id "${{ secrets.APPLE_ID_EMAIL }}" --password "${{ secrets.APPLE_ID_PASSWORD }}" --team-id "${{ secrets.APPLE_ID_TEAM }}" --wait
94-
xcrun stapler staple build/out/PlumeImpactor.dmg
95-
86+
cargo build --bin ${{ env.BINARY_NAME }} --release
87+
cp target/release/${{ env.BINARY_NAME }}.exe build/out
88+
9689
- name: Upload Bundles
9790
uses: actions/upload-artifact@v4
9891
with:
99-
name: plumeimpactor-macos
92+
name: ${{ env.BINARY_NAME }}-windows
10093
path: build/out/*
10194

102-
build-macos-intel:
103-
runs-on: macos-15-intel
95+
build-macos-arm:
96+
runs-on: macos-latest
10497
steps:
10598
- uses: actions/checkout@v4
10699
- name: Cache Rust dependencies
@@ -110,45 +103,35 @@ jobs:
110103
~/.cargo/registry
111104
~/.cargo/git
112105
target
113-
key: macos-intel-cargo-${{ hashFiles('**/Cargo.lock') }}
114-
restore-keys: macos-intel-cargo-
115-
106+
key: macos-arm-cargo-${{ hashFiles('**/Cargo.lock') }}
107+
restore-keys: macos-arm-cargo-
108+
116109
- name: Install Rust stable
117110
uses: dtolnay/rust-toolchain@stable
118-
119-
- name: Setup macOS Certificates
120-
uses: apple-actions/import-codesign-certs@v5
121111
with:
122-
p12-file-base64: ${{ secrets.DEV_ID_P12_BASE64 }}
123-
p12-password: ${{ secrets.DEV_ID_P12_PASSWORD }}
124-
112+
targets: aarch64-apple-darwin
113+
125114
- name: Build Dependencies
126115
run: |
127116
cargo install patch-crate
128117
cargo fetch --locked || true
129118
cargo patch-crate --force
130-
cargo install cargo-bundle
131119
mkdir -p build/out
132-
mkdir -p build/dmg
133-
134-
- name: Build & Bundle (macOS Intel)
120+
121+
- name: Build (macOS ARM)
135122
run: |
136-
cargo bundle --bin plumeimpactor --package plumeimpactor --release --format osx
137-
cp -R target/release/bundle/osx/plumeimpactor.app build/dmg/plumeimpactor.app
138-
codesign --deep --force --options runtime --sign "${{ secrets.DEV_ID_IDENTITY_NAME }}" build/dmg/plumeimpactor.app
139-
ln -s /Applications build/dmg/Applications
140-
hdiutil create -volname plumeimpactor -srcfolder build/dmg -ov -format UDZO build/out/PlumeImpactor.dmg
141-
xcrun notarytool submit build/out/PlumeImpactor.dmg --apple-id "${{ secrets.APPLE_ID_EMAIL }}" --password "${{ secrets.APPLE_ID_PASSWORD }}" --team-id "${{ secrets.APPLE_ID_TEAM }}" --wait
142-
xcrun stapler staple build/out/PlumeImpactor.dmg
143-
144-
- name: Upload Bundles
123+
cargo build --bin ${{ env.BINARY_NAME }} --release
124+
strip target/release/${{ env.BINARY_NAME }}
125+
cp target/release/${{ env.BINARY_NAME }} build/out/${{ env.BINARY_NAME }}-arm
126+
127+
- name: Upload ARM Slice
145128
uses: actions/upload-artifact@v4
146129
with:
147-
name: plumeimpactor-macos-intel
148-
path: build/out/*
130+
name: ${{ env.BINARY_NAME }}-macos-slice-arm
131+
path: build/out/${{ env.BINARY_NAME }}-arm
149132

150-
build-windows:
151-
runs-on: windows-latest
133+
build-macos-intel:
134+
runs-on: macos-15-intel
152135
steps:
153136
- uses: actions/checkout@v4
154137
- name: Cache Rust dependencies
@@ -158,33 +141,83 @@ jobs:
158141
~/.cargo/registry
159142
~/.cargo/git
160143
target
161-
key: windows-cargo-${{ hashFiles('**/Cargo.lock') }}
162-
restore-keys: windows-cargo-
163-
144+
key: macos-intel-cargo-${{ hashFiles('**/Cargo.lock') }}
145+
restore-keys: macos-intel-cargo-
146+
164147
- name: Install Rust stable
165148
uses: dtolnay/rust-toolchain@stable
166-
167-
- name: Setup Windows dependencies
168-
run: choco install strawberryperl make --no-progress
169-
170-
- name: Setup Windows MSVC environment
171-
uses: ilammy/msvc-dev-cmd@v1
172-
149+
173150
- name: Build Dependencies
174151
run: |
175152
cargo install patch-crate
176153
cargo fetch --locked || true
177154
cargo patch-crate --force
178-
cargo install cargo-bundle
179155
mkdir -p build/out
180-
181-
- name: Build & Bundle (Windows)
156+
157+
- name: Build (macOS Intel)
182158
run: |
183-
cargo build --bin plumeimpactor --release
184-
cp target/release/plumeimpactor.exe build/out
185-
186-
- name: Upload Bundles
159+
cargo build --bin ${{ env.BINARY_NAME }} --release
160+
strip target/release/${{ env.BINARY_NAME }}
161+
cp target/release/${{ env.BINARY_NAME }} build/out/${{ env.BINARY_NAME }}-intel
162+
163+
- name: Upload Intel Slice
187164
uses: actions/upload-artifact@v4
188165
with:
189-
name: plumeimpactor-windows
190-
path: build/out/*
166+
name: ${{ env.BINARY_NAME }}-macos-slice-intel
167+
path: build/out/${{ env.BINARY_NAME }}-intel
168+
169+
build-macos-universal:
170+
runs-on: macos-latest
171+
needs: [build-macos-arm, build-macos-intel]
172+
steps:
173+
- uses: actions/checkout@v4
174+
175+
- name: Get ARM Slice
176+
uses: actions/download-artifact@v4
177+
with:
178+
name: ${{ env.BINARY_NAME }}-macos-slice-arm
179+
path: build/slices
180+
181+
- name: Get Intel Slice
182+
uses: actions/download-artifact@v4
183+
with:
184+
name: ${{ env.BINARY_NAME }}-macos-slice-intel
185+
path: build/slices
186+
187+
- name: Setup Certificates
188+
uses: apple-actions/import-codesign-certs@v5
189+
with:
190+
p12-file-base64: ${{ secrets.DEV_ID_P12_BASE64 }}
191+
p12-password: ${{ secrets.DEV_ID_P12_PASSWORD }}
192+
193+
- name: Create Universal Binary
194+
run: |
195+
mkdir -p build/universal
196+
lipo -create -output build/universal/${{ env.BINARY_NAME }} build/slices/${{ env.BINARY_NAME }}-arm build/slices/${{ env.BINARY_NAME }}-intel
197+
198+
- name: Bundle
199+
run: |
200+
cp -R package/macos/${{ env.BUNDLE_NAME }}.app build/dmg/${{ env.BUNDLE_NAME }}.app
201+
mv build/universal/${{ env.BINARY_NAME }} build/dmg/${{ env.BUNDLE_NAME }}.app/Contents/MacOS/${{ env.BINARY_NAME }}
202+
203+
- name: Codesign
204+
run: |
205+
codesign --deep --force --options runtime \
206+
--entitlements package/macos/entitlements.plist \
207+
--sign "${{ secrets.DEV_ID_IDENTITY_NAME }}" build/dmg/${{ env.BUNDLE_NAME }}.app
208+
209+
- name: Create DMG
210+
run: |
211+
ln -s /Applications build/dmg/Applications
212+
hdiutil create -volname ${{ env.BUNDLE_NAME }} -srcfolder build/dmg -ov -format UDZO build/out/${{ env.BUNDLE_NAME }}.dmg
213+
214+
- name: Notarize DMG
215+
run: |
216+
xcrun notarytool submit build/out/${{ env.BUNDLE_NAME }}.dmg --apple-id "${{ secrets.APPLE_ID_EMAIL }}" --password "${{ secrets.APPLE_ID_PASSWORD }}" --team-id "${{ secrets.APPLE_ID_TEAM }}" --wait
217+
xcrun stapler staple build/out/${{ env.BUNDLE_NAME }}.dmg
218+
219+
- name: Upload Universal DMG
220+
uses: actions/upload-artifact@v4
221+
with:
222+
name: ${{ env.BINARY_NAME }}-macos-universal
223+
path: build/out/${{ env.BUNDLE_NAME }}.dmg

apps/plumeimpactor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ rustls = { version = "0.23.32", features = ["ring"] }
3535

3636
keyring = { version = "3.6.3", default-features = false, features = ["windows-native", "apple-native", "linux-native"] }
3737

38-
[build-dependencies]
38+
[target.'cfg(windows)'.build-dependencies]
3939
embed-manifest = "1.4"

apps/plumeimpactor/build.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use embed_manifest::manifest::{ActiveCodePage, Setting, SupportedOS::*};
2-
use embed_manifest::{embed_manifest, new_manifest};
3-
1+
#[cfg(windows)]
42
fn main() {
53
println!("cargo:rerun-if-changed=build.rs");
64
let target = std::env::var("TARGET").unwrap_or_default();
@@ -11,7 +9,14 @@ fn main() {
119
}
1210
}
1311

12+
#[cfg(not(windows))]
13+
fn main() {}
14+
15+
#[cfg(windows)]
1416
fn embed_windows_manifest(name: &str) {
17+
use embed_manifest::manifest::{ActiveCodePage, Setting, SupportedOS::*};
18+
use embed_manifest::{embed_manifest, new_manifest};
19+
1520
let manifest = new_manifest(name)
1621
.supported_os(Windows7..=Windows10)
1722
.active_code_page(ActiveCodePage::Utf8)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>plumeimpactor</string>
9+
<key>CFBundleExecutable</key>
10+
<string>plumeimpactor</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>bucket.plumeimpactor</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>plumeimpactor</string>
17+
<key>CFBundlePackageType</key>
18+
<string>APPL</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>0.0.1</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
<key>CSResourcesFileMapped</key>
24+
<true/>
25+
<key>LSRequiresCarbon</key>
26+
<true/>
27+
<key>NSHighResolutionCapable</key>
28+
<true/>
29+
</dict>
30+
</plist>

package/macos/entitlements.plist

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
4-
<dict>
5-
<key>keychain-access-groups</key>
6-
<array>
7-
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
8-
</array>
9-
</dict>
10-
</plist>
4+
<dict>
5+
<key>keychain-access-groups</key>
6+
<array>
7+
<string>566RT33SA2.bucket.plumeimpactor</string>
8+
</array>
9+
</dict>
10+
</plist>

0 commit comments

Comments
 (0)