-
Notifications
You must be signed in to change notification settings - Fork 10
247 lines (239 loc) · 8.17 KB
/
rust.yml
File metadata and controls
247 lines (239 loc) · 8.17 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
name: Rust
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
release:
types: [published]
env:
CARGO_TERM_COLOR: always
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Build Rust
run: cargo build --verbose --release
- name: Copy Dependencies
run: cp ./resources/sciter.dll ./target/release/sciter.dll
- name: Create Windows zip
run: Compress-Archive -Path ./target/release/cele-mod.exe,./target/release/sciter.dll -DestinationPath "celemod-windows.zip"
- uses: actions/upload-artifact@v4.3.1
with:
name: windows-exe
path: ./target/release/cele-mod.exe
- uses: actions/upload-artifact@v4.3.1
with:
name: windows-zip
path: celemod-windows.zip
build-linux:
runs-on: ubuntu-22.04
steps:
- name: Install dependencies
run: |
sudo sh -c 'echo "deb http://archive.ubuntu.com/ubuntu focal-updates main" > /etc/apt/sources.list.d/focal-updates.list'
sudo apt-get update
sudo apt-get install -y \
pkg-config \
cmake \
clang \
libpango-1.0-0 \
libatk1.0-dev \
libgtk-3-dev \
file
- uses: actions/checkout@v3
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Build Rust
run: cargo build --verbose --release
- name: Download AppImage tools
run: |
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage appimagetool-x86_64.AppImage
- name: Create AppDir
run: |
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/lib
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
mkdir -p AppDir/usr/share/applications
# Copy binary and library
cp ./target/release/cele-mod AppDir/usr/bin/cele-mod
cp ./resources/libsciter.so AppDir/usr/lib/libsciter.so
chmod +x AppDir/usr/bin/cele-mod
# Copy icon
cp ./resources/icon.png AppDir/usr/share/icons/hicolor/256x256/apps/celemod.png
# Create .desktop file
cat > AppDir/usr/share/applications/celemod.desktop << 'EOF'
[Desktop Entry]
Name=CeleMod
Comment=Celeste Mod Manager
Exec=cele-mod
Icon=celemod
Terminal=false
Type=Application
Categories=Game;Utility;
EOF
# Create symlinks
ln -s usr/share/applications/celemod.desktop AppDir/celemod.desktop
ln -s usr/share/icons/hicolor/256x256/apps/celemod.png AppDir/celemod.png
ln -s usr/bin/cele-mod AppDir/AppRun
- name: Build AppImage
run: |
ARCH=x86_64 ./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage || true
# Fallback: use appimagetool directly if linuxdeploy fails
if [ ! -f CeleMod-*.AppImage ]; then
ARCH=x86_64 ./appimagetool-x86_64.AppImage AppDir CeleMod-x86_64.AppImage
fi
mv CeleMod-*.AppImage celemod-linux.AppImage || true
- name: Create zip fallback
run: |
mkdir -p celemod-linux
cp ./target/release/cele-mod celemod-linux/cele-mod
cp ./resources/libsciter.so celemod-linux/libsciter.so
cp ./resources/icon.png celemod-linux/celemod.png
zip -r "celemod-linux.zip" celemod-linux
- uses: actions/upload-artifact@v4.3.1
with:
name: linux-zip
path: celemod-linux.zip
- uses: actions/upload-artifact@v4.3.1
with:
name: linux-appimage
path: celemod-linux.AppImage
build-macos:
runs-on: macos-latest
steps:
- name: Install dependencies
run: |
brew install pango
brew install gtk+3
brew install protobuf
brew install create-dmg
- uses: actions/checkout@v3
- name: Install latest nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Build Rust MacOS
run: export CMAKE_POLICY_VERSION_MINIMUM=3.5 && cargo build --verbose --release
- name: Create macOS app bundle
run: |
mkdir -p CeleMod.app/Contents/MacOS
mkdir -p CeleMod.app/Contents/Resources
cp ./target/release/cele-mod CeleMod.app/Contents/MacOS/CeleMod
cp ./resources/libsciter.dylib CeleMod.app/Contents/MacOS/libsciter.dylib
cp ./resources/icon.icns CeleMod.app/Contents/Resources/AppIcon.icns
chmod +x CeleMod.app/Contents/MacOS/CeleMod
# Create Info.plist with icon
cat > CeleMod.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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>CeleMod</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>CFBundleIdentifier</key>
<string>com.celemod.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>CeleMod</string>
<key>CFBundleDisplayName</key>
<string>CeleMod</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.13</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2024 CeleMod. All rights reserved.</string>
</dict>
</plist>
EOF
- name: Ad-hoc sign app bundle
run: |
codesign --force --deep -s - CeleMod.app
- name: Create DMG (optional)
run: |
create-dmg --volname "CeleMod" --volicon "./resources/icon.icns" --window-pos 200 120 --window-size 800 400 --icon-size 100 --app-drop-link 600 185 "CeleMod.dmg" "CeleMod.app" || true
# If create-dmg fails, just zip the app
if [ ! -f CeleMod.dmg ]; then
zip -r "celemod-macos.zip" CeleMod.app
fi
- name: Prepare artifact
run: |
if [ -f CeleMod.dmg ]; then
mv CeleMod.dmg celemod-macos.dmg
else
# Ensure zip exists
if [ ! -f celemod-macos.zip ]; then
zip -r "celemod-macos.zip" CeleMod.app
fi
fi
- uses: actions/upload-artifact@v4.3.1
with:
name: macos-app
path: |
celemod-macos.dmg
celemod-macos.zip
release:
runs-on: ubuntu-latest
needs: [build-windows, build-linux, build-macos]
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v4
with:
name: windows-exe
path: .
- uses: actions/download-artifact@v4
with:
name: windows-zip
path: .
- uses: actions/download-artifact@v4
with:
name: linux-zip
path: .
- uses: actions/download-artifact@v4
with:
name: linux-appimage
path: .
- uses: actions/download-artifact@v4
with:
name: macos-app
path: .
- name: Prepare release files
run: mv cele-mod.exe "cele-mod-no-dependencies.exe"
- uses: softprops/action-gh-release@v1
with:
files: |
cele-mod-no-dependencies.exe
celemod-windows.zip
celemod-linux.zip
celemod-linux.AppImage
celemod-macos.dmg
celemod-macos.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}