-
Notifications
You must be signed in to change notification settings - Fork 12
713 lines (604 loc) · 28.1 KB
/
release.yml
File metadata and controls
713 lines (604 loc) · 28.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
name: Release Dash Evo Tool
on:
push:
tags:
- 'v*'
- 'v*-dev.*'
release:
types:
- published
workflow_dispatch:
inputs:
tag:
description: "Version (i.e. v0.1.0)"
required: false
permissions:
id-token: write
attestations: write
contents: write
jobs:
build-and-release:
name: Build and Release Dash Evo Tool
strategy:
matrix:
include:
- name: "linux-x86_64"
runs-on: "ubuntu-22.04"
target: "x86_64-unknown-linux-gnu"
platform: "linux-x86_64"
- name: "linux-arm64"
runs-on: "ubuntu-22.04-arm"
target: "aarch64-unknown-linux-gnu"
platform: "linux-arm64"
- name: "Windows"
runs-on: "ubuntu-22.04"
target: "x86_64-pc-windows-gnu"
platform: "windows"
ext: ".exe"
runs-on: ${{ matrix.runs-on }}
steps:
- name: Free disk space
if: ${{ runner.os == 'Linux' }}
run: |
echo "=== Disk space before cleanup ==="
df -h
# Remove large unnecessary directories
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /opt/hostedtoolcache/go
sudo rm -rf /opt/hostedtoolcache/node
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/local/graalvm
sudo rm -rf /usr/local/.ghcup
# Clean docker
sudo docker image prune --all --force || true
sudo docker system prune --all --force || true
# Clean apt cache
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
echo "=== Disk space after cleanup ==="
df -h
- name: Check out code
uses: actions/checkout@v4
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Setup prerequisites
run: |
mkdir -p dash-evo-tool/
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Install essentials
if: ${{ runner.os == 'Linux' }}
run: sudo apt-get update && sudo apt-get install -y build-essential pkg-config clang cmake unzip libsqlite3-dev gcc-mingw-w64 mingw-w64 libsqlite3-dev mingw-w64-x86-64-dev gcc-aarch64-linux-gnu zip && uname -a && cargo clean
- name: Install protoc (ARM)
if: ${{ matrix.platform == 'linux-arm64' }}
run: curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protoc-25.2-linux-aarch_64.zip && sudo unzip -o protoc-25.2-linux-aarch_64.zip -d /usr/local bin/protoc && sudo unzip -o protoc-25.2-linux-aarch_64.zip -d /usr/local 'include/*' && rm -f protoc-25.2-linux-aarch_64.zip
env:
PROTOC: /usr/local/bin/protoc
- name: Install protoc (AMD)
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
run: curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protoc-25.2-linux-x86_64.zip && sudo unzip -o protoc-25.2-linux-x86_64.zip -d /usr/local bin/protoc && sudo unzip -o protoc-25.2-linux-x86_64.zip -d /usr/local 'include/*' && rm -f protoc-25.2-linux-x86_64.zip
env:
PROTOC: /usr/local/bin/protoc
- name: Install protoc (Windows)
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
run: curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protoc-25.2-linux-x86_64.zip && sudo unzip -o protoc-25.2-linux-x86_64.zip -d /usr/local bin/protoc && sudo unzip -o protoc-25.2-linux-x86_64.zip -d /usr/local 'include/*' && rm -f protoc-25.2-linux-x86_64.zip
env:
PROTOC: /usr/local/bin/protoc
- name: Windows libsql
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
run: curl -OL https://www.sqlite.org/2024/sqlite-dll-win-x64-3460100.zip && sudo unzip -o sqlite-dll-win-x64-3460100.zip -d winlibs && sudo chown -R runner:docker winlibs/ && pwd && ls -lah && cd winlibs && x86_64-w64-mingw32-dlltool -d sqlite3.def -l libsqlite3.a && ls -lah && cd ..
- name: Build project
run: |
cargo build --release --target ${{ matrix.target }}
mv target/${{ matrix.target }}/release/dash-evo-tool${{ matrix.ext }} dash-evo-tool/dash-evo-tool${{ matrix.ext }}
env:
CC_x86_64_pc_windows_gnu: x86_64-w64-mingw32-gcc
AR_x86_64_pc_windows_gnu: x86_64-w64-mingw32-ar
CFLAGS_x86_64_pc_windows_gnu: "-O2"
- name: Package release
run: |
zip -r dash-evo-tool-${{ matrix.platform }}.zip dash-evo-tool/
- name: Attest
uses: actions/attest-build-provenance@v1
with:
subject-path: 'dash-evo-tool-${{ matrix.platform }}.zip'
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: dash-evo-tool-${{ matrix.platform }}.zip
path: dash-evo-tool-${{ matrix.platform }}.zip
build-macos-arm64:
name: Build macOS ARM64 (Signed & Notarized)
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Add Rust target
run: rustup target add aarch64-apple-darwin
- name: Initial disk cleanup
run: |
echo "Disk usage before initial cleanup:"
df -h
# Clean up homebrew cache
brew cleanup --prune=all || true
# Remove Xcode caches
sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/dyld 2>/dev/null || true
sudo rm -rf ~/Library/Developer/Xcode/DerivedData 2>/dev/null || true
sudo rm -rf ~/Library/Caches/com.apple.dt.Xcode 2>/dev/null || true
# Clean system caches
sudo rm -rf /Library/Caches/* 2>/dev/null || true
sudo rm -rf /System/Library/Caches/* 2>/dev/null || true
sudo rm -rf /private/var/folders/* 2>/dev/null || true
echo "Disk usage after initial cleanup:"
df -h
- name: Install protoc
run: |
brew install protobuf
protoc --version
- name: Build ARM64 architecture
run: |
cargo build --release --target aarch64-apple-darwin
mkdir -p build
cp target/aarch64-apple-darwin/release/dash-evo-tool build/dash-evo-tool
chmod +x build/dash-evo-tool
# Targeted cleanup - only remove build artifacts we don't need
rm -rf target/aarch64-apple-darwin/release/deps
rm -rf target/aarch64-apple-darwin/release/build
rm -rf target/aarch64-apple-darwin/release/incremental
rm -rf target/aarch64-apple-darwin/release/.fingerprint
rm -rf target/aarch64-apple-darwin/debug
rm -rf target/debug
# Remove the actual binary from target since we copied it
rm -f target/aarch64-apple-darwin/release/dash-evo-tool
# Create app bundle structure
mkdir -p "build/Dash Evo Tool.app/Contents/MacOS"
mkdir -p "build/Dash Evo Tool.app/Contents/Resources"
# Move binary into app bundle
cp build/dash-evo-tool "build/Dash Evo Tool.app/Contents/MacOS/dash-evo-tool"
# Create icon set and convert to ICNS
mkdir -p AppIcon.iconset
# Create all required icon sizes from the logo (which already has 8% padding)
sips -z 16 16 assets/DET_LOGO.png --out AppIcon.iconset/icon_16x16.png
sips -z 32 32 assets/DET_LOGO.png --out AppIcon.iconset/icon_16x16@2x.png
sips -z 32 32 assets/DET_LOGO.png --out AppIcon.iconset/icon_32x32.png
sips -z 64 64 assets/DET_LOGO.png --out AppIcon.iconset/icon_32x32@2x.png
sips -z 128 128 assets/DET_LOGO.png --out AppIcon.iconset/icon_128x128.png
sips -z 256 256 assets/DET_LOGO.png --out AppIcon.iconset/icon_128x128@2x.png
sips -z 256 256 assets/DET_LOGO.png --out AppIcon.iconset/icon_256x256.png
sips -z 512 512 assets/DET_LOGO.png --out AppIcon.iconset/icon_256x256@2x.png
sips -z 512 512 assets/DET_LOGO.png --out AppIcon.iconset/icon_512x512.png
sips -z 1024 1024 assets/DET_LOGO.png --out AppIcon.iconset/icon_512x512@2x.png
iconutil -c icns AppIcon.iconset
cp AppIcon.icns "build/Dash Evo Tool.app/Contents/Resources/AppIcon.icns"
# Create Info.plist
cat > "build/Dash Evo Tool.app/Contents/Info.plist" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>dash-evo-tool</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>CFBundleIdentifier</key>
<string>org.dash.evo-tool</string>
<key>CFBundleName</key>
<string>Dash Evo Tool</string>
<key>CFBundleDisplayName</key>
<string>Dash Evo Tool</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>
EOF
- name: Import signing certificates
uses: Apple-Actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- name: Resolve signing identity
id: signid
run: |
ID=$(security find-identity -v -p codesigning | grep "Developer ID Application" | sed -E 's/.*"(.+)"/\1/' | head -n1)
echo "IDENTITY=$ID" >> "$GITHUB_OUTPUT"
- name: Code sign app bundle with hardened runtime and timestamp
run: |
# Create entitlements file
cat > entitlements.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>
EOF
# Sign the app bundle (deep signing to get all components)
codesign --force --deep --options runtime --timestamp \
--sign "${{ steps.signid.outputs.IDENTITY }}" \
--entitlements entitlements.plist \
"build/Dash Evo Tool.app"
# Verify the signature
codesign --verify --deep --strict --verbose=2 "build/Dash Evo Tool.app"
- name: Free up disk space before DMG creation
run: |
echo "Disk usage before cleanup:"
df -h
du -sh ~/* 2>/dev/null | sort -rh | head -20
# Remove the ENTIRE target directory since we already copied the binary
rm -rf target
# Remove the entire Cargo directory
rm -rf ~/.cargo
# Clean up homebrew completely
brew cleanup --prune=all
rm -rf $(brew --cache)
# Remove any unnecessary Xcode simulators and caches
sudo rm -rf ~/Library/Developer/CoreSimulator 2>/dev/null || true
sudo rm -rf ~/Library/Developer/Xcode 2>/dev/null || true
sudo rm -rf ~/Library/Caches 2>/dev/null || true
# Remove temporary icon files after creating the app bundle
rm -rf AppIcon.iconset 2>/dev/null || true
# Clean system caches more aggressively
sudo rm -rf /Library/Caches/* 2>/dev/null || true
sudo rm -rf /System/Library/Caches/* 2>/dev/null || true
sudo rm -rf /private/var/folders/* 2>/dev/null || true
sudo rm -rf /Users/runner/Library/Caches/* 2>/dev/null || true
# Remove any iOS simulators and SDKs we don't need
sudo rm -rf /Library/Developer/CoreSimulator 2>/dev/null || true
sudo rm -rf /Applications/Xcode*.app/Contents/Developer/Platforms/iPhoneOS.platform 2>/dev/null || true
sudo rm -rf /Applications/Xcode*.app/Contents/Developer/Platforms/AppleTVOS.platform 2>/dev/null || true
sudo rm -rf /Applications/Xcode*.app/Contents/Developer/Platforms/WatchOS.platform 2>/dev/null || true
echo "Disk usage after cleanup:"
df -h
du -sh ~/* 2>/dev/null | sort -rh | head -20
- name: Create DMG
run: |
# Get app size for sparse image
APP_SIZE=$(du -sm "build/Dash Evo Tool.app" | cut -f1)
DMG_SIZE=$((APP_SIZE + 50)) # Add 50MB padding
# Create a sparse image instead of using srcfolder
# Sparse images only use disk space as needed
hdiutil create -size ${DMG_SIZE}m -type SPARSE -fs HFS+ -volname "Dash Evo Tool" temp.sparseimage
# Mount the sparse image
hdiutil mount temp.sparseimage -mountpoint /Volumes/"Dash Evo Tool"
# Copy app to mounted volume
cp -r "build/Dash Evo Tool.app" /Volumes/"Dash Evo Tool"/
ln -s /Applications /Volumes/"Dash Evo Tool"/Applications
# Remove macOS metadata directories that get created automatically
rm -rf /Volumes/"Dash Evo Tool"/.fseventsd
rm -rf /Volumes/"Dash Evo Tool"/.Spotlight-V100
rm -f /Volumes/"Dash Evo Tool"/.DS_Store
# Unmount
hdiutil detach /Volumes/"Dash Evo Tool"
# Convert sparse image to compressed DMG
hdiutil convert temp.sparseimage -format UDZO -o dash-evo-tool-macos-arm64.dmg
# Clean up sparse image
rm -f temp.sparseimage
# Sign the DMG
codesign --force --sign "${{ steps.signid.outputs.IDENTITY }}" dash-evo-tool-macos-arm64.dmg
- name: Validate Apple credentials
run: |
if [ -z "${{ secrets.APPLE_ID }}" ]; then
echo "Error: APPLE_ID secret is not set"
exit 1
fi
if [ -z "${{ secrets.APPLE_TEAM_ID }}" ]; then
echo "Error: APPLE_TEAM_ID secret is not set"
exit 1
fi
if [ -z "${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}" ]; then
echo "Error: APPLE_APP_SPECIFIC_PASSWORD secret is not set"
exit 1
fi
echo "Apple credentials validation passed"
- name: Notarize DMG
run: |
echo "Submitting DMG for notarization..."
xcrun notarytool submit dash-evo-tool-macos-arm64.dmg \
--apple-id "${{ secrets.APPLE_ID }}" \
--team-id "${{ secrets.APPLE_TEAM_ID }}" \
--password "${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}" \
--wait --verbose
echo "Stapling notarization ticket..."
xcrun stapler staple dash-evo-tool-macos-arm64.dmg
- name: Attest
uses: actions/attest-build-provenance@v1
with:
subject-path: 'dash-evo-tool-macos-arm64.dmg'
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: dash-evo-tool-macos-arm64.dmg
path: dash-evo-tool-macos-arm64.dmg
build-macos-x86:
name: Build macOS x86_64 (Signed & Notarized)
runs-on: macos-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Add Rust target
run: rustup target add x86_64-apple-darwin
- name: Initial disk cleanup
run: |
echo "Disk usage before initial cleanup:"
df -h
# Clean up homebrew cache
brew cleanup --prune=all || true
# Remove Xcode caches
sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/dyld 2>/dev/null || true
sudo rm -rf ~/Library/Developer/Xcode/DerivedData 2>/dev/null || true
sudo rm -rf ~/Library/Caches/com.apple.dt.Xcode 2>/dev/null || true
# Clean system caches
sudo rm -rf /Library/Caches/* 2>/dev/null || true
sudo rm -rf /System/Library/Caches/* 2>/dev/null || true
sudo rm -rf /private/var/folders/* 2>/dev/null || true
echo "Disk usage after initial cleanup:"
df -h
- name: Install protoc
run: |
brew install protobuf
protoc --version
- name: Build x86_64 architecture
run: |
cargo build --release --target x86_64-apple-darwin
mkdir -p build
cp target/x86_64-apple-darwin/release/dash-evo-tool build/dash-evo-tool
chmod +x build/dash-evo-tool
# Targeted cleanup - only remove build artifacts we don't need
rm -rf target/x86_64-apple-darwin/release/deps
rm -rf target/x86_64-apple-darwin/release/build
rm -rf target/x86_64-apple-darwin/release/incremental
rm -rf target/x86_64-apple-darwin/release/.fingerprint
rm -rf target/x86_64-apple-darwin/debug
rm -rf target/debug
# Remove the actual binary from target since we copied it
rm -f target/x86_64-apple-darwin/release/dash-evo-tool
# Create app bundle structure
mkdir -p "build/Dash Evo Tool.app/Contents/MacOS"
mkdir -p "build/Dash Evo Tool.app/Contents/Resources"
# Move binary into app bundle
cp build/dash-evo-tool "build/Dash Evo Tool.app/Contents/MacOS/dash-evo-tool"
# Create icon set and convert to ICNS
mkdir -p AppIcon.iconset
# Create all required icon sizes from the logo (which already has 8% padding)
sips -z 16 16 assets/DET_LOGO.png --out AppIcon.iconset/icon_16x16.png
sips -z 32 32 assets/DET_LOGO.png --out AppIcon.iconset/icon_16x16@2x.png
sips -z 32 32 assets/DET_LOGO.png --out AppIcon.iconset/icon_32x32.png
sips -z 64 64 assets/DET_LOGO.png --out AppIcon.iconset/icon_32x32@2x.png
sips -z 128 128 assets/DET_LOGO.png --out AppIcon.iconset/icon_128x128.png
sips -z 256 256 assets/DET_LOGO.png --out AppIcon.iconset/icon_128x128@2x.png
sips -z 256 256 assets/DET_LOGO.png --out AppIcon.iconset/icon_256x256.png
sips -z 512 512 assets/DET_LOGO.png --out AppIcon.iconset/icon_256x256@2x.png
sips -z 512 512 assets/DET_LOGO.png --out AppIcon.iconset/icon_512x512.png
sips -z 1024 1024 assets/DET_LOGO.png --out AppIcon.iconset/icon_512x512@2x.png
iconutil -c icns AppIcon.iconset
cp AppIcon.icns "build/Dash Evo Tool.app/Contents/Resources/AppIcon.icns"
# Create Info.plist
cat > "build/Dash Evo Tool.app/Contents/Info.plist" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>dash-evo-tool</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>CFBundleIdentifier</key>
<string>org.dash.evo-tool</string>
<key>CFBundleName</key>
<string>Dash Evo Tool</string>
<key>CFBundleDisplayName</key>
<string>Dash Evo Tool</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
</dict>
</plist>
EOF
- name: Import signing certificates
uses: Apple-Actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- name: Resolve signing identity
id: signid
run: |
ID=$(security find-identity -v -p codesigning | grep "Developer ID Application" | sed -E 's/.*"(.+)"/\1/' | head -n1)
echo "IDENTITY=$ID" >> "$GITHUB_OUTPUT"
- name: Code sign app bundle with hardened runtime and timestamp
run: |
# Create entitlements file
cat > entitlements.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>
EOF
# Sign the app bundle (deep signing to get all components)
codesign --force --deep --options runtime --timestamp \
--sign "${{ steps.signid.outputs.IDENTITY }}" \
--entitlements entitlements.plist \
"build/Dash Evo Tool.app"
# Verify the signature
codesign --verify --deep --strict --verbose=2 "build/Dash Evo Tool.app"
- name: Free up disk space before DMG creation
run: |
echo "Disk usage before cleanup:"
df -h
du -sh ~/* 2>/dev/null | sort -rh | head -20
# Remove the ENTIRE target directory since we already copied the binary
rm -rf target
# Remove the entire Cargo directory
rm -rf ~/.cargo
# Clean up homebrew completely
brew cleanup --prune=all
rm -rf $(brew --cache)
# Remove any unnecessary Xcode simulators and caches
sudo rm -rf ~/Library/Developer/CoreSimulator 2>/dev/null || true
sudo rm -rf ~/Library/Developer/Xcode 2>/dev/null || true
sudo rm -rf ~/Library/Caches 2>/dev/null || true
# Remove temporary icon files after creating the app bundle
rm -rf AppIcon.iconset 2>/dev/null || true
# Clean system caches more aggressively
sudo rm -rf /Library/Caches/* 2>/dev/null || true
sudo rm -rf /System/Library/Caches/* 2>/dev/null || true
sudo rm -rf /private/var/folders/* 2>/dev/null || true
sudo rm -rf /Users/runner/Library/Caches/* 2>/dev/null || true
# Remove any iOS simulators and SDKs we don't need
sudo rm -rf /Library/Developer/CoreSimulator 2>/dev/null || true
sudo rm -rf /Applications/Xcode*.app/Contents/Developer/Platforms/iPhoneOS.platform 2>/dev/null || true
sudo rm -rf /Applications/Xcode*.app/Contents/Developer/Platforms/AppleTVOS.platform 2>/dev/null || true
sudo rm -rf /Applications/Xcode*.app/Contents/Developer/Platforms/WatchOS.platform 2>/dev/null || true
echo "Disk usage after cleanup:"
df -h
du -sh ~/* 2>/dev/null | sort -rh | head -20
- name: Create DMG
run: |
# Get app size for sparse image
APP_SIZE=$(du -sm "build/Dash Evo Tool.app" | cut -f1)
DMG_SIZE=$((APP_SIZE + 50)) # Add 50MB padding
# Create a sparse image instead of using srcfolder
# Sparse images only use disk space as needed
hdiutil create -size ${DMG_SIZE}m -type SPARSE -fs HFS+ -volname "Dash Evo Tool" temp.sparseimage
# Mount the sparse image
hdiutil mount temp.sparseimage -mountpoint /Volumes/"Dash Evo Tool"
# Copy app to mounted volume
cp -r "build/Dash Evo Tool.app" /Volumes/"Dash Evo Tool"/
ln -s /Applications /Volumes/"Dash Evo Tool"/Applications
# Unmount
hdiutil detach /Volumes/"Dash Evo Tool"
# Convert sparse image to compressed DMG
hdiutil convert temp.sparseimage -format UDZO -o dash-evo-tool-macos-x86_64.dmg
# Clean up sparse image
rm -f temp.sparseimage
# Sign the DMG
codesign --force --sign "${{ steps.signid.outputs.IDENTITY }}" dash-evo-tool-macos-x86_64.dmg
- name: Validate Apple credentials
run: |
if [ -z "${{ secrets.APPLE_ID }}" ]; then
echo "Error: APPLE_ID secret is not set"
exit 1
fi
if [ -z "${{ secrets.APPLE_TEAM_ID }}" ]; then
echo "Error: APPLE_TEAM_ID secret is not set"
exit 1
fi
if [ -z "${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}" ]; then
echo "Error: APPLE_APP_SPECIFIC_PASSWORD secret is not set"
exit 1
fi
echo "Apple credentials validation passed"
- name: Notarize DMG
run: |
echo "Submitting DMG for notarization..."
xcrun notarytool submit dash-evo-tool-macos-x86_64.dmg \
--apple-id "${{ secrets.APPLE_ID }}" \
--team-id "${{ secrets.APPLE_TEAM_ID }}" \
--password "${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}" \
--wait --verbose
echo "Stapling notarization ticket..."
xcrun stapler staple dash-evo-tool-macos-x86_64.dmg
- name: Attest
uses: actions/attest-build-provenance@v1
with:
subject-path: 'dash-evo-tool-macos-x86_64.dmg'
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: dash-evo-tool-macos-x86_64.dmg
path: dash-evo-tool-macos-x86_64.dmg
release:
name: Create GitHub Release
needs: [build-and-release, build-macos-arm64, build-macos-x86]
runs-on: ubuntu-latest
steps:
- name: Download Linux AMD64 Artifact
uses: actions/download-artifact@v4
with:
name: dash-evo-tool-linux-x86_64.zip
- name: Download Linux Arm64 Artifact
uses: actions/download-artifact@v4
with:
name: dash-evo-tool-linux-arm64.zip
- name: Download macOS ARM64 Artifact
uses: actions/download-artifact@v4
with:
name: dash-evo-tool-macos-arm64.dmg
- name: Download macOS x86_64 Artifact
uses: actions/download-artifact@v4
with:
name: dash-evo-tool-macos-x86_64.dmg
- name: Download Windows Artifact
uses: actions/download-artifact@v4
with:
name: dash-evo-tool-windows.zip
- name: Publish release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event.inputs.tag != '' }}
with:
tag_name: ${{ github.event.inputs.tag }}
files: |
./dash-evo-tool-linux-x86_64.zip
./dash-evo-tool-linux-arm64.zip
./dash-evo-tool-macos-arm64.dmg
./dash-evo-tool-macos-x86_64.dmg
./dash-evo-tool-windows.zip
draft: false
prerelease: true