-
Notifications
You must be signed in to change notification settings - Fork 1
370 lines (330 loc) · 13.7 KB
/
Copy pathrelease.yml
File metadata and controls
370 lines (330 loc) · 13.7 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
name: Build Installers
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build-linux-installer-payload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.6'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libgdk-pixbuf2.0-dev libopusfile-dev libasound2-dev ffmpeg squashfs-tools binutils-multiarch
- name: Build Linux AMD64 payload for installer
run: |
./build_appimage.sh amd64
mkdir -p payload
cp -L dist/gozik-amd64.AppImage payload/gozik-amd64.AppImage
chmod +x payload/gozik-amd64.AppImage
cp gozik.png payload/gozik.png
tar -czf gozik-payload-linux-amd64.tar.gz -C payload .
- uses: actions/upload-artifact@v4
with:
name: gozik-payload-linux-amd64
path: gozik-payload-linux-amd64.tar.gz
build-windows-installer-payload:
runs-on: ${{ matrix.runs-on }}
continue-on-error: ${{ matrix.allow_failure }}
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
allow_failure: false
runs-on: windows-latest
msystem: MINGW64
mingw-prefix: mingw64
cc: gcc
output: gozik-windows-amd64
msys2-packages: >-
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-gtk3
mingw-w64-x86_64-opus
mingw-w64-x86_64-opusfile
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-ntldd
ffmpeg-url: "https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip"
- arch: arm64
allow_failure: true
runs-on: windows-11-arm
msystem: CLANGARM64
mingw-prefix: clangarm64
cc: clang
output: gozik-windows-arm64
msys2-packages: >-
mingw-w64-clang-aarch64-toolchain
mingw-w64-clang-aarch64-gtk3
mingw-w64-clang-aarch64-opus
mingw-w64-clang-aarch64-opusfile
mingw-w64-clang-aarch64-pkg-config
mingw-w64-clang-aarch64-ntldd
ffmpeg-url: "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-winarm64-gpl.zip"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.6'
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
cache: false
path-type: inherit
install: ${{ matrix.msys2-packages }}
- name: Patch gotk3 for Windows ARM64
if: matrix.arch == 'arm64'
shell: msys2 {0}
run: |
go mod download github.com/gotk3/gotk3
GOTK3_VERSION=$(grep 'github.com/gotk3/gotk3' go.mod | awk '{print $2}')
GOMODCACHE=$(cygpath -u "$(go env GOMODCACHE)")
GOTK3_DIR="${GOMODCACHE}/github.com/gotk3/gotk3@${GOTK3_VERSION}"
if [ -d "$GOTK3_DIR" ]; then
find "$GOTK3_DIR" -name '*.go.h' -print0 | xargs -0 sed -i \
-e 's/^extern void /extern __declspec(dllexport) void /' \
-e 's/^extern gboolean /extern __declspec(dllexport) gboolean /' \
-e 's/^extern gint /extern __declspec(dllexport) gint /'
fi
- name: Build gozik
shell: msys2 {0}
run: |
export PATH="/${{ matrix.mingw-prefix }}/bin:$PATH"
export CC="${{ matrix.cc }}"
export CGO_ENABLED=1
export CGO_CFLAGS="-Wno-dll-attribute-on-redeclaration"
go build -ldflags="-s -w" -o gozik.exe ./cmd/gozik
- name: Download ffmpeg
shell: powershell
run: |
Invoke-WebRequest -Uri "${{ matrix.ffmpeg-url }}" -OutFile "ffmpeg.zip"
Expand-Archive -Path "ffmpeg.zip" -DestinationPath "ffmpeg_extracted"
$ffmpeg = Get-ChildItem -Path "ffmpeg_extracted" -Recurse -Filter "ffmpeg.exe" | Select-Object -First 1
Copy-Item $ffmpeg.FullName -Destination "ffmpeg.exe"
- name: Collect GTK DLLs and image loaders
shell: msys2 {0}
run: |
export PATH="/${{ matrix.mingw-prefix }}/bin:$PATH"
mkdir -p "${{ matrix.output }}"
cp gozik.exe "${{ matrix.output }}/"
./installer/scripts/collect-windows-dlls.sh "${{ matrix.mingw-prefix }}" "${{ matrix.output }}"
- name: Build Windows ${{ matrix.arch }} payload for installer
shell: powershell
run: |
New-Item -ItemType Directory -Path "${{ matrix.output }}" -Force | Out-Null
Copy-Item "ffmpeg.exe" "${{ matrix.output }}\"
Copy-Item -Recurse "assets" "${{ matrix.output }}\"
tar -czf "gozik-payload-windows-${{ matrix.arch }}.tar.gz" -C "${{ matrix.output }}" .
- uses: actions/upload-artifact@v4
with:
name: gozik-payload-windows-${{ matrix.arch }}
path: gozik-payload-windows-${{ matrix.arch }}.tar.gz
build-macos-installer-payload:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.6'
- name: Install dependencies
run: |
brew install gtk+3 pkg-config opus opusfile dylibbundler
- name: Build gozik
run: |
export CGO_ENABLED=1
export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
go build -ldflags="-s -w" -o gozik ./cmd/gozik
- name: Download ffmpeg
run: |
curl -L -A "Mozilla/5.0" -o ffmpeg.zip "https://evermeet.cx/ffmpeg/getrelease/ffmpeg/zip"
unzip -o ffmpeg.zip
chmod +x ffmpeg
- name: Assemble app bundle
run: |
APP="Gozik.app"
mkdir -p "$APP/Contents/MacOS"
mkdir -p "$APP/Contents/Resources"
cp gozik "$APP/Contents/MacOS/"
cp ffmpeg "$APP/Contents/MacOS/"
cp -R assets "$APP/Contents/MacOS/"
cat > "$APP/Contents/MacOS/gozik-launcher.sh" <<'EOF'
#!/bin/bash
DIR="$(cd "$(dirname "$0")" && pwd)"
export GOZIK_ASSETS="$DIR/assets"
export PATH="$DIR:$PATH"
exec "$DIR/gozik" "$@"
EOF
chmod +x "$APP/Contents/MacOS/gozik-launcher.sh"
cat > "$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>gozik-launcher.sh</string>
<key>CFBundleIdentifier</key>
<string>com.gosuda.gozik.player</string>
<key>CFBundleName</key>
<string>Gozik</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${{ github.ref_name }}</string>
<key>CFBundleVersion</key>
<string>${{ github.run_number }}</string>
<key>LSMinimumSystemVersion</key>
<string>11.0</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
EOF
- name: Bundle GTK dylibs and image loaders
run: |
APP="Gozik.app"
mkdir -p "$APP/Contents/Frameworks"
dylibbundler -od -b -x "$APP/Contents/MacOS/gozik" -d "$APP/Contents/Frameworks/"
# Bundle gdk-pixbuf loaders into Resources so the runtime can point
# at them with an env var.
for prefix in /opt/homebrew /usr/local; do
if [ -d "$prefix/lib/gdk-pixbuf-2.0" ]; then
VERSION_DIR="$(find "$prefix/lib/gdk-pixbuf-2.0" -maxdepth 1 -type d -name '2.*' | head -n1)"
if [ -n "$VERSION_DIR" ] && [ -d "${VERSION_DIR}/loaders" ]; then
RES_DIR="$APP/Contents/Resources/lib/gdk-pixbuf-2.0/$(basename "$VERSION_DIR")"
mkdir -p "${RES_DIR}/loaders"
cp -L "${VERSION_DIR}/loaders/"*.so "${RES_DIR}/loaders/"
gdk-pixbuf-query-loaders "${RES_DIR}/loaders/"*.so > "${RES_DIR}/loaders.cache"
sed -i "" "s|\"${RES_DIR}/|\"|g; s|\"${VERSION_DIR}/loaders/|\"|g" "${RES_DIR}/loaders.cache"
break
fi
fi
done
- name: Build macOS ARM64 payload for installer
run: |
mkdir -p payload
cp -R Gozik.app payload/
tar -czf gozik-payload-macos-arm64.tar.gz -C payload .
- uses: actions/upload-artifact@v4
with:
name: gozik-payload-macos-arm64
path: gozik-payload-macos-arm64.tar.gz
build-linux-niche-installer-payload:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
include:
- platform: linux/arm64
output: gozik-linux-arm64
arch: arm64
cc: aarch64-linux-gnu-gcc
cc-target: aarch64-linux-gnu
- platform: linux/riscv64
output: gozik-linux-riscv64
arch: riscv64
cc: riscv64-linux-gnu-gcc
cc-target: riscv64-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.6'
- name: Install cross dependencies (${{ matrix.arch }})
run: |
sudo dpkg --add-architecture ${{ matrix.arch }}
CODENAME=$(lsb_release -c -s)
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak || true
if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then
sudo mv /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak || true
fi
cat <<EOF | sudo tee /etc/apt/sources.list
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${CODENAME} main restricted universe multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${CODENAME}-updates main restricted universe multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${CODENAME}-backports main restricted universe multiverse
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ ${CODENAME}-security main restricted universe multiverse
deb [arch=${{ matrix.arch }}] http://ports.ubuntu.com/ubuntu-ports/ ${CODENAME} main restricted universe multiverse
deb [arch=${{ matrix.arch }}] http://ports.ubuntu.com/ubuntu-ports/ ${CODENAME}-updates main restricted universe multiverse
deb [arch=${{ matrix.arch }}] http://ports.ubuntu.com/ubuntu-ports/ ${CODENAME}-backports main restricted universe multiverse
deb [arch=${{ matrix.arch }}] http://ports.ubuntu.com/ubuntu-ports/ ${CODENAME}-security main restricted universe multiverse
EOF
sudo apt-get update
sudo apt-get install -y gcc-${{ matrix.cc-target }} libgtk-3-dev:${{ matrix.arch }} libopusfile-dev:${{ matrix.arch }} libasound2-dev:${{ matrix.arch }}
- name: Build
env:
CGO_ENABLED: 1
GOOS: linux
GOARCH: ${{ matrix.arch }}
CC: ${{ matrix.cc }}
PKG_CONFIG_LIBDIR: /usr/lib/${{ matrix.cc-target }}/pkgconfig:/usr/share/pkgconfig
run: |
go build -ldflags="-s -w" -o ${{ matrix.output }} ./cmd/gozik
- name: Build Linux ${{ matrix.arch }} payload for installer
run: |
mkdir -p "payload/gozik"
cp "${{ matrix.output }}" payload/gozik/gozik
chmod +x payload/gozik/gozik
cp -R assets payload/gozik/assets
mkdir -p payload/gozik/assets/icons/hicolor/256x256/apps
cp gozik.png payload/gozik/assets/icons/hicolor/256x256/apps/gozik.png
tar -czf "gozik-payload-linux-${{ matrix.arch }}.tar.gz" -C payload/gozik .
- uses: actions/upload-artifact@v4
with:
name: gozik-payload-linux-${{ matrix.arch }}
path: gozik-payload-linux-${{ matrix.arch }}.tar.gz
build-installer-binaries:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.6'
- name: Build installer binaries
run: |
cd installer
go mod tidy
./scripts/build.sh dist "${{ github.ref_name }}"
- uses: actions/upload-artifact@v4
with:
name: gozik-installers
path: installer/dist/gozik-installer-*
- uses: actions/upload-artifact@v4
with:
name: gozik-uninstallers
path: installer/dist/gozik-uninstaller-*
release:
runs-on: ubuntu-latest
needs: [build-linux-installer-payload, build-windows-installer-payload, build-macos-installer-payload, build-linux-niche-installer-payload, build-installer-binaries]
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
pattern: gozik-*
merge-multiple: true
- name: Keep only missing assets on automatic release
id: release-assets
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
if find artifacts -type f | grep -q .; then
echo "has_files=true" >> "$GITHUB_OUTPUT"
else
echo "No release assets left to upload."
echo "has_files=false" >> "$GITHUB_OUTPUT"
fi
- uses: softprops/action-gh-release@v2
if: steps.release-assets.outputs.has_files == 'true'
with:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
files: artifacts/*
generate_release_notes: true
overwrite: true