-
-
Notifications
You must be signed in to change notification settings - Fork 161
258 lines (254 loc) · 8.98 KB
/
release.yml
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
name: Release
on:
push:
tags:
- 'v*'
jobs:
build-macos:
runs-on: macos-11
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
-
name: Build docs to /help
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade wheel
python3 -m pip install mkdocs-material
mkdocs build -d help
-
name: Install PyOxidizer
run: python3 -m pip install pyoxidizer==0.22.0
-
name: Download ffmpeg
uses: carlosperate/download-file-action@v2
id: download_ffmpeg
with:
file-url: 'https://evermeet.cx/ffmpeg/getrelease/ffmpeg/7z'
file-name: 'ffmpeg-macos.7z'
location: '.'
-
name: Process ffmpeg
run: |
cd $GITHUB_WORKSPACE
7z e ffmpeg-macos.7z -obin "ffmpeg"
-
name: Build Hydrus
run: |
cd $GITHUB_WORKSPACE
cp static/build_files/macos/pyoxidizer.bzl pyoxidizer.bzl
cp static/build_files/macos/requirements.txt requirements.txt
basename $(rustc --print sysroot) | sed -e "s/^stable-//" > triple.txt
pyoxidizer build --release
cd build/$(head -n 1 triple.txt)/release
mkdir -p "Hydrus Network.app/Contents/MacOS"
mkdir -p "Hydrus Network.app/Contents/Resources"
mkdir -p "Hydrus Network.app/Contents/Frameworks"
mv install/static/icon.icns "Hydrus Network.app/Contents/Resources/icon.icns"
cp install/static/build_files/macos/Info.plist "Hydrus Network.app/Contents/Info.plist"
cp install/static/build_files/macos/ReadMeFirst.rtf ./ReadMeFirst.rtf
cp install/static/build_files/macos/running_from_app "install/running_from_app"
ln -s /Applications ./Applications
mv install/* "Hydrus Network.app/Contents/MacOS/"
rm -rf install
-
name: Build DMG
run: |
cd $GITHUB_WORKSPACE
temp_dmg="$(mktemp).dmg"
hdiutil create "$temp_dmg" -ov -volname "HydrusNetwork" -fs HFS+ -format UDZO -srcfolder "$GITHUB_WORKSPACE/build/$(head -n 1 triple.txt)/release"
mv "$temp_dmg" HydrusNetwork.dmg
-
name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: MacOS-DMG
path: HydrusNetwork.dmg
if-no-files-found: error
retention-days: 2
build-ubuntu:
runs-on: ubuntu-20.04
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
path: hydrus
-
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: x64
-
name: APT Install
run: |
sudo apt-get update
sudo apt-get install -y libmpv1
-
name: Pip Install
run: python3 -m pip install -r hydrus/static/build_files/linux/requirements.txt
-
name: Build docs to /help
run: mkdocs build -d help
working-directory: hydrus
-
name: Build Hydrus
run: |
cp hydrus/static/build_files/linux/hydrus_client.spec hydrus_client.spec
cp hydrus/static/build_files/linux/hydrus_server.spec hydrus_server.spec
pyinstaller hydrus_server.spec
pyinstaller hydrus_client.spec
-
name: Remove Chonk
run: |
find dist/hydrus_client/ -type f -name "*.pyc" -delete
while read line; do find dist/hydrus_client/ -type f -name "${line}" -delete ; done < hydrus/static/build_files/linux/files_to_delete.txt
-
name: Remove Surplus File
run: |
rm -f dist/hydrus_client/libxkbcommon.so*
-
name: Set Permissions
run: |
sudo chown --recursive 1000:1000 dist/hydrus_client
sudo find dist/hydrus_client -type d -exec chmod 0755 {} \;
sudo chmod +x dist/hydrus_client/hydrus_client dist/hydrus_client/hydrus_server dist/hydrus_client/bin/swfrender_linux
-
name: Compress Client
run: |
mv dist/hydrus_client "dist/Hydrus Network"
tar --zstd -cvf Ubuntu-Extract.tar.zst -C dist "Hydrus Network"
-
name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: Ubuntu-Extract
path: Ubuntu-Extract.tar.zst
if-no-files-found: error
retention-days: 2
build-windows:
runs-on: windows-2019
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
path: hydrus
-
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: x64
-
name: Pip Install
run: python3 -m pip install -r hydrus/static/build_files/windows/requirements.txt
-
name: Build docs to /help
run: mkdocs build -d help
working-directory: hydrus
-
name: Download mpv-dev
uses: carlosperate/download-file-action@v2
id: download_mpv
with:
file-url: 'https://sourceforge.net/projects/mpv-player-windows/files/libmpv/mpv-dev-x86_64-20230212-git-a40958c.7z'
file-name: 'mpv-dev-x86_64.7z'
location: '.'
-
name: Process mpv-dev
run: |
7z x mpv-dev-x86_64.7z -ompv
move mpv\libmpv-2.dll hydrus\mpv-2.dll
-
name: Download ffmpeg
uses: carlosperate/download-file-action@v2
id: download_ffmpeg
with:
file-url: 'https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z'
file-name: 'ffmpeg-release-full.7z'
location: '.'
-
name: Process ffmpeg
run: |
7z e ffmpeg-release-full.7z -ohydrus/bin "**/bin/ffmpeg.exe"
-
name: Build Hydrus
run: |
move hydrus\static\build_files\windows\sqlite3.dll hydrus\
move hydrus\static\build_files\windows\sqlite3.exe hydrus\db
move hydrus\static\build_files\windows\file_version_info_maker.py file_version_info_maker.py
python file_version_info_maker.py ${{ github.ref_name }}
move hydrus\static\build_files\windows\hydrus_client.spec hydrus_client.spec
move hydrus\static\build_files\windows\hydrus_server.spec hydrus_server.spec
pyinstaller hydrus_server.spec
pyinstaller hydrus_client.spec
move dist\hydrus_client "dist\Hydrus Network"
-
# yo pretty sure we'll need to install this manually once we are on windows server 2022
# https://github.com/actions/virtual-environments/issues/4856
name: InnoSetup
run: |
move hydrus\static\build_files\windows\InnoSetup.iss InnoSetup.iss
ISCC.exe InnoSetup.iss /DVersion=${{ github.ref_name }}
-
name: Compress Client
run: |
cd .\dist
7z.exe a -tzip -mm=Deflate -mx=5 ..\Windows-Extract.zip 'Hydrus Network'
cd ..
-
name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: Windows-Install
path: dist\HydrusInstaller.exe
if-no-files-found: error
retention-days: 2
-
name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: Windows-Extract
path: Windows-Extract.zip
if-no-files-found: error
retention-days: 2
create-release:
name: Upload to Release
runs-on: ubuntu-20.04
needs: [build-windows, build-ubuntu, build-macos]
steps:
-
name: Get All Artifacts
uses: actions/download-artifact@v3
-
name: Extract Version Metadata
id: meta
run: |
echo "version=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "version_short=${GITHUB_REF##*/v}" >> $GITHUB_ENV
-
name: Rename Files
run: |
mkdir ubuntu windows
mv Windows-Install/HydrusInstaller.exe Hydrus.Network.${{ env.version_short }}.-.Windows.-.Installer.exe
mv Windows-Extract/Windows-Extract.zip Hydrus.Network.${{ env.version_short }}.-.Windows.-.Extract.only.zip
mv Ubuntu-Extract/Ubuntu-Extract.tar.zst Hydrus.Network.${{ env.version_short }}.-.Linux.-.Executable.tar.zst
mv MacOS-DMG/HydrusNetwork.dmg Hydrus.Network.${{ env.version_short }}.-.macOS.-.App.dmg
-
name: Upload Files
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
Hydrus.Network.${{ env.version_short }}.-.Windows.-.Installer.exe
Hydrus.Network.${{ env.version_short }}.-.Windows.-.Extract.only.zip
Hydrus.Network.${{ env.version_short }}.-.Linux.-.Executable.tar.zst
Hydrus.Network.${{ env.version_short }}.-.macOS.-.App.dmg