-
Notifications
You must be signed in to change notification settings - Fork 28
310 lines (273 loc) · 10.4 KB
/
release.yml
File metadata and controls
310 lines (273 loc) · 10.4 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
name: Build Release
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin]
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
output_name: radiance
artifact_name: radiance-linux-x86_64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
output_name: radiance
artifact_name: radiance-linux-aarch64
- target: x86_64-pc-windows-gnu
os: ubuntu-latest
output_name: radiance.exe
artifact_name: radiance-windows-x86_64
- target: x86_64-apple-darwin
os: macos-latest
output_name: radiance
artifact_name: radiance-macos-x86_64
- target: aarch64-apple-darwin
os: macos-latest
output_name: radiance
artifact_name: radiance-macos-aarch64
fail-fast: false
steps:
- name: Checkout radiance repository
uses: actions/checkout@v4
with:
path: radiance
- name: Checkout libmpv-static-build repository
uses: actions/checkout@v4
with:
repository: ervanalb/libmpv-static-build
path: libmpv-static-build
- name: Get libmpv-static-build commit hash
id: libmpv-hash
run: |
cd libmpv-static-build
echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Install build tools (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
pkg-config \
clang
case "${{ matrix.target }}" in
x86_64-unknown-linux-gnu)
;;
aarch64-unknown-linux-gnu)
sudo apt-get install -y \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
libc6-dev-arm64-cross \
libc6-arm64-cross
;;
x86_64-pc-windows-gnu)
sudo apt-get install -y \
mingw-w64 \
mingw-w64-tools
;;
esac
- name: Install build tools (macOS)
if: runner.os == 'macOS'
run: |
brew install \
pkg-config \
autoconf \
automake \
libtool \
yasm \
nasm \
cmake \
meson \
ninja
pip3 install --break-system-packages jinja2 mako
- name: Restore libmpv static build cache
id: cache-libmpv
uses: actions/cache/restore@v4
with:
path: libmpv-static-build/${{ matrix.target }}/output
key: libmpv-static-${{ runner.os }}-${{ matrix.target }}-${{ steps.libmpv-hash.outputs.hash }}
- name: Install libmpv build dependencies
if: runner.os == 'Linux' && steps.cache-libmpv.outputs.cache-hit != 'true'
run: |
sudo apt-get install -y \
build-essential \
autoconf \
automake \
libtool \
yasm \
nasm \
git \
python3 \
python3-pip \
cmake \
meson \
python3-mako \
bison \
flex \
ninja-build
if [ "${{ matrix.target }}" = "x86_64-pc-windows-gnu" ]; then
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
fi
- name: Build libmpv static libraries
if: steps.cache-libmpv.outputs.cache-hit != 'true'
run: |
cd libmpv-static-build
./scripts/prepare_sysroot.sh download
./scripts/all.sh download
TARGET=${{ matrix.target }} ./scripts/prepare_sysroot.sh build
TARGET=${{ matrix.target }} ./scripts/all.sh build
- name: Save libmpv static build cache
if: steps.cache-libmpv.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: libmpv-static-build/${{ matrix.target }}/output
key: libmpv-static-${{ runner.os }}-${{ matrix.target }}-${{ steps.libmpv-hash.outputs.hash }}
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build radiance
run: |
cd radiance
TARGET=${{ matrix.target }} ./.github/scripts/build.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: radiance/target/${{ matrix.target }}/release/${{ matrix.output_name }}
create-universal-macos:
runs-on: macos-latest
needs: build
steps:
- name: Checkout radiance repository
uses: actions/checkout@v4
- name: Install ImageMagick
run: brew install imagemagick
- name: Download x86_64 macOS binary
uses: actions/download-artifact@v4
with:
name: radiance-macos-x86_64
path: macos-x86_64
- name: Download aarch64 macOS binary
uses: actions/download-artifact@v4
with:
name: radiance-macos-aarch64
path: macos-aarch64
- name: Create universal binary
run: |
lipo -create \
macos-x86_64/radiance \
macos-aarch64/radiance \
-output radiance-universal
chmod +x radiance-universal
- name: Create .app bundle
run: |
# Create app bundle structure
mkdir -p Radiance.app/Contents/MacOS
mkdir -p Radiance.app/Contents/Resources
# Move the universal binary into the bundle
mv radiance-universal Radiance.app/Contents/MacOS/radiance
# Create Info.plist
cat > Radiance.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>radiance</string>
<key>CFBundleIconFile</key>
<string>radiance.icns</string>
<key>CFBundleIdentifier</key>
<string>video.radiance</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Radiance</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleVersion</key>
<string>0.1.0</string>
<key>LSMinimumSystemVersion</key>
<string>11.0</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSMicrophoneUsageDescription</key>
<string>Radiance uses audio input for beat tracking and music-reactive visuals.</string>
</dict>
</plist>
EOF
# Create iconset from logo
mkdir radiance.iconset
# Generate all required icon sizes
magick library/logo.png -resize 16x16 radiance.iconset/icon_16x16.png
magick library/logo.png -resize 32x32 radiance.iconset/icon_16x16@2x.png
magick library/logo.png -resize 32x32 radiance.iconset/icon_32x32.png
magick library/logo.png -resize 64x64 radiance.iconset/icon_32x32@2x.png
magick library/logo.png -resize 128x128 radiance.iconset/icon_128x128.png
magick library/logo.png -resize 256x256 radiance.iconset/icon_128x128@2x.png
magick library/logo.png -resize 256x256 radiance.iconset/icon_256x256.png
magick library/logo.png -resize 512x512 radiance.iconset/icon_256x256@2x.png
magick library/logo.png -resize 512x512 radiance.iconset/icon_512x512.png
magick library/logo.png -resize 1024x1024 radiance.iconset/icon_512x512@2x.png
# Convert iconset to icns
iconutil -c icns radiance.iconset -o Radiance.app/Contents/Resources/radiance.icns
# Clean up iconset
rm -rf radiance.iconset
- name: Create DMG
run: |
# Create a temporary directory for the DMG contents
mkdir dmg-contents
cp -R Radiance.app dmg-contents/
# Create an alias to the Applications folder
ln -s /Applications dmg-contents/Applications
# Create the DMG
hdiutil create -volname "Radiance" -srcfolder dmg-contents -ov -format UDZO Radiance.dmg
- name: Upload DMG artifact
uses: actions/upload-artifact@v4
with:
name: radiance-macos-universal
path: Radiance.dmg
- name: Delete individual macOS artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: |
radiance-macos-x86_64
radiance-macos-aarch64
create-release:
runs-on: ubuntu-latest
needs: [build, create-universal-macos]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir release-files
VERSION=${GITHUB_REF#refs/tags/}
# Linux binaries
cp artifacts/radiance-linux-x86_64/radiance release-files/radiance-${VERSION}-linux-x86_64
cp artifacts/radiance-linux-aarch64/radiance release-files/radiance-${VERSION}-linux-aarch64
# Windows binary
cp artifacts/radiance-windows-x86_64/radiance.exe release-files/radiance-${VERSION}-windows-x86_64.exe
# macOS DMG
cp artifacts/radiance-macos-universal/Radiance.dmg release-files/Radiance-${VERSION}-macos-universal.dmg
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: |
release-files/radiance-*-linux-x86_64
release-files/radiance-*-linux-aarch64
release-files/radiance-*-windows-x86_64.exe
release-files/Radiance-*-macos-universal.dmg
token: ${{ secrets.GITHUB_TOKEN }}