Skip to content

Commit ae4ac8a

Browse files
committed
Restore macos.yml and fix its workflow triggers
1 parent 3cb7458 commit ae4ac8a

2 files changed

Lines changed: 99 additions & 2 deletions

File tree

.github/workflows/macos.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: MacOS Build
2+
on:
3+
workflow_dispatch:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
jobs:
8+
build:
9+
runs-on: macos-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Install Rust
14+
uses: dtolnay/rust-toolchain@stable
15+
16+
- name: Install dependencies
17+
run: brew install ffmpeg libopenmpt dylibbundler create-dmg
18+
19+
- name: Build executable
20+
env:
21+
LIBRARY_PATH: /opt/homebrew/lib
22+
CPATH: /opt/homebrew/include
23+
PKG_CONFIG_PATH: /opt/homebrew/lib/pkgconfig:/opt/homebrew/share/pkgconfig
24+
BINDGEN_EXTRA_CLANG_ARGS: "-I/opt/homebrew/include"
25+
run: cargo build --release
26+
27+
- name: Package Application
28+
run: |
29+
VERSION=$(grep -m1 '^version =' Cargo.toml | cut -d '"' -f2)
30+
31+
mkdir -p RustTracker.app/Contents/MacOS
32+
mkdir -p RustTracker.app/Contents/Resources
33+
mkdir -p RustTracker.app/Contents/Frameworks
34+
35+
# Create ICNS icon
36+
mkdir -p RustTracker.iconset
37+
sips -z 16 16 icon.png --out RustTracker.iconset/icon_16x16.png
38+
sips -z 32 32 icon.png --out RustTracker.iconset/icon_16x16@2x.png
39+
sips -z 32 32 icon.png --out RustTracker.iconset/icon_32x32.png
40+
sips -z 64 64 icon.png --out RustTracker.iconset/icon_32x32@2x.png
41+
sips -z 128 128 icon.png --out RustTracker.iconset/icon_128x128.png
42+
sips -z 256 256 icon.png --out RustTracker.iconset/icon_128x128@2x.png
43+
sips -z 256 256 icon.png --out RustTracker.iconset/icon_256x256.png
44+
sips -z 512 512 icon.png --out RustTracker.iconset/icon_256x256@2x.png
45+
sips -z 512 512 icon.png --out RustTracker.iconset/icon_512x512.png
46+
sips -z 1024 1024 icon.png --out RustTracker.iconset/icon_512x512@2x.png
47+
iconutil -c icns RustTracker.iconset -o RustTracker.app/Contents/Resources/AppIcon.icns
48+
rm -rf RustTracker.iconset
49+
50+
# Generate Info.plist
51+
cat <<EOF > RustTracker.app/Contents/Info.plist
52+
<?xml version="1.0" encoding="UTF-8"?>
53+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
54+
<plist version="1.0">
55+
<dict>
56+
<key>CFBundleExecutable</key>
57+
<string>rusttracker</string>
58+
<key>CFBundleIdentifier</key>
59+
<string>com.soddentrough.rusttracker</string>
60+
<key>CFBundleName</key>
61+
<string>RustTracker</string>
62+
<key>CFBundleIconFile</key>
63+
<string>AppIcon</string>
64+
<key>CFBundleShortVersionString</key>
65+
<string>${VERSION}</string>
66+
<key>CFBundleVersion</key>
67+
<string>${VERSION}</string>
68+
<key>CFBundlePackageType</key>
69+
<string>APPL</string>
70+
<key>LSMinimumSystemVersion</key>
71+
<string>10.15</string>
72+
</dict>
73+
</plist>
74+
EOF
75+
76+
# Copy binary and bundle libraries
77+
cp target/release/rusttracker RustTracker.app/Contents/MacOS/
78+
dylibbundler -od -b -x RustTracker.app/Contents/MacOS/rusttracker -d RustTracker.app/Contents/Frameworks/ -p @executable_path/../Frameworks/
79+
80+
- name: Create DMG
81+
run: |
82+
create-dmg \
83+
--volname "RustTracker Installer" \
84+
--window-pos 200 120 \
85+
--window-size 600 400 \
86+
--icon-size 100 \
87+
--icon "RustTracker.app" 200 190 \
88+
--app-drop-link 400 190 \
89+
"RustTracker-MacOS-Installer.dmg" \
90+
"RustTracker.app"
91+
92+
- name: Upload Artifact
93+
uses: actions/upload-artifact@v5
94+
with:
95+
name: RustTracker-MacOS
96+
path: RustTracker-MacOS-Installer.dmg

release_script.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ if [ "$CONCLUSION" == "success" ]; then
2121
echo "CI pipeline completed successfully."
2222

2323
echo "Cleaning old artifact directories..."
24-
rm -rf ./linux_rpm ./linux_deb ./windows_release
24+
rm -rf ./linux_rpm ./linux_deb ./windows_release ./macos_release
2525

2626
echo "Downloading artifacts..."
2727
gh run download -n RustTracker-Linux-RPM --dir ./linux_rpm || true
2828
gh run download -n RustTracker-Linux-DEB --dir ./linux_deb || true
2929
gh run download -n RustTracker-Windows --dir ./windows_release || true
30+
gh run download -n RustTracker-MacOS --dir ./macos_release || true
3031

3132
echo "Creating GitHub Release..."
32-
gh release create "$TAG" ./windows_release/*.exe ./linux_rpm/*.rpm ./linux_deb/*.deb ./RustTracker-SteamDeck-$TAG.AppImage --title "RustTracker $TAG" --notes "Release $TAG"
33+
gh release create "$TAG" ./windows_release/*.exe ./linux_rpm/*.rpm ./linux_deb/*.deb ./macos_release/*.dmg ./RustTracker-SteamDeck-$TAG.AppImage --title "RustTracker $TAG" --notes "Release $TAG"
3334
fi
3435
echo "Done!"

0 commit comments

Comments
 (0)