forked from xfangfang/Macast
-
Notifications
You must be signed in to change notification settings - Fork 0
560 lines (506 loc) · 26.1 KB
/
build-macast.yaml
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
# Copyright (c) 2021 by xfangfang. All Rights Reserved.
name: Build Macast
on:
push:
branches:
- dev_test
pull_request:
workflow_dispatch:
inputs:
ssh_darwin:
description: 'SSH connection to Darwin'
required: false
default: 'false'
ssh_ubuntu:
description: 'SSH connection to Ubuntu'
required: false
default: 'false'
release:
description: 'Push a new release'
required: false
default: 'false'
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.info.outputs.version }}
standard_version: ${{ steps.info.outputs.standard_version }}
DIST_DMG: ${{ steps.info.outputs.DIST_DMG }}
DIST_DMG_ARM: ${{ steps.info.outputs.DIST_DMG_ARM }}
DIST_EXE: ${{ steps.info.outputs.DIST_EXE }}
DIST_EXE_DEBUG: ${{ steps.info.outputs.DIST_EXE_DEBUG }}
DIST_EXE32: ${{ steps.info.outputs.DIST_EXE32 }}
DIST_EXE32_DEBUG: ${{ steps.info.outputs.DIST_EXE32_DEBUG }}
DIST_AMD64: ${{ steps.info.outputs.DIST_AMD64 }}
DIST_AMD64_DEB: ${{ steps.info.outputs.DIST_AMD64_DEB }}
DIST_ARMV7: ${{ steps.info.outputs.DIST_ARMV7 }}
DIST_ARMV7_DEB: ${{ steps.info.outputs.DIST_ARMV7_DEB }}
DIST_ARMV8: ${{ steps.info.outputs.DIST_ARMV8 }}
DIST_ARMV8_DEB: ${{ steps.info.outputs.DIST_ARMV8_DEB }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Debug version
run: |
export VERSION=`git rev-parse --short HEAD`
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Release version
if: github.event.inputs.release == 'true' && github.event.inputs.release != 'false' && !cancelled()
run: |
export VERSION=`python3 -c "exec(open('macast/__pkginfo__.py').read()); print(__version__)"`
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Version
id: info
env:
VERSION: ${{ env.VERSION }}
run: |
export STANDARD_VERSION=`python3 -c "exec(open('macast/__pkginfo__.py').read()); print(__version__)"`
echo "::set-output name=version::${VERSION}"
echo "::set-output name=standard_version::${STANDARD_VERSION}"
echo "::set-output name=DIST_DMG::Macast-MacOS-${VERSION}-IntelChip.dmg"
echo "::set-output name=DIST_DMG_ARM::Macast-MacOS-${VERSION}-AppleSilicon.dmg"
echo "::set-output name=DIST_EXE::Macast-Windows-${VERSION}-x64.exe"
echo "::set-output name=DIST_EXE_DEBUG::Macast-Windows-${VERSION}-x64-debug.exe"
echo "::set-output name=DIST_EXE32::Macast-Windows-${VERSION}-x86.exe"
echo "::set-output name=DIST_EXE32_DEBUG::Macast-Windows-${VERSION}-x86-debug.exe"
echo "::set-output name=DIST_AMD64::Macast-Linux-${VERSION}-amd64"
echo "::set-output name=DIST_AMD64_DEB::Macast-Linux-${VERSION}-amd64.deb"
echo "::set-output name=DIST_ARMV7::Macast-Linux-${VERSION}-armv7"
echo "::set-output name=DIST_ARMV7_DEB::Macast-Linux-${VERSION}-armv7.deb"
echo "::set-output name=DIST_ARMV8::Macast-Linux-${VERSION}-armv8"
echo "::set-output name=DIST_ARMV8_DEB::Macast-Linux-${VERSION}-armv8.deb"
echo $VERSION
echo $STANDARD_VERSION
release:
needs: [ build-win-x64, build-macos-apple, build-macos-intel, build-linux-amd64, build-linux-armv7, build-linux-armv8, build-win-x86, version ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
if: github.event.inputs.release == 'true' && github.event.inputs.release != 'false' && !cancelled()
- name: Version
if: github.event.inputs.release == 'true' && github.event.inputs.release != 'false' && !cancelled()
run: |
echo "VERSION=${{ needs.version.outputs.version }}" >> $GITHUB_ENV
echo "DIST_DMG=${{ needs.version.outputs.DIST_DMG }}" >> $GITHUB_ENV
echo "DIST_DMG_ARM=${{ needs.version.outputs.DIST_DMG_ARM }}" >> $GITHUB_ENV
echo "DIST_EXE=${{ needs.version.outputs.DIST_EXE }}" >> $GITHUB_ENV
echo "DIST_EXE_DEBUG=${{ needs.version.outputs.DIST_EXE_DEBUG }}" >> $GITHUB_ENV
echo "DIST_EXE32=${{ needs.version.outputs.DIST_EXE32 }}" >> $GITHUB_ENV
echo "DIST_EXE32_DEBUG=${{ needs.version.outputs.DIST_EXE32_DEBUG }}" >> $GITHUB_ENV
echo "DIST_AMD64=${{ needs.version.outputs.DIST_AMD64 }}" >> $GITHUB_ENV
echo "DIST_AMD64_DEB=${{ needs.version.outputs.DIST_AMD64_DEB }}" >> $GITHUB_ENV
echo "DIST_ARMV7=${{ needs.version.outputs.DIST_ARMV7 }}" >> $GITHUB_ENV
echo "DIST_ARMV7_DEB=${{ needs.version.outputs.DIST_ARMV7_DEB }}" >> $GITHUB_ENV
echo "DIST_ARMV8=${{ needs.version.outputs.DIST_ARMV8 }}" >> $GITHUB_ENV
echo "DIST_ARMV8_DEB=${{ needs.version.outputs.DIST_ARMV8_DEB }}" >> $GITHUB_ENV
echo $GITHUB_ENV
- name: Upload
if: github.event.inputs.release == 'true' && github.event.inputs.release != 'false' && !cancelled()
uses: ncipollo/release-action@v1
with:
name: Macast ${{ env.VERSION }}
tag: ${{ env.VERSION }}
omitBodyDuringUpdate: true
body: This release is built by github-action.
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
artifacts: >
${{ env.DIST_DMG }}/${{ env.DIST_DMG }},
${{ env.DIST_DMG_ARM }}/${{ env.DIST_DMG_ARM }},
${{ env.DIST_EXE }}/${{ env.DIST_EXE }},
${{ env.DIST_EXE_DEBUG }}/${{ env.DIST_EXE_DEBUG }},
${{ env.DIST_EXE32 }}/${{ env.DIST_EXE32 }},
${{ env.DIST_EXE32_DEBUG }}/${{ env.DIST_EXE32_DEBUG }},
${{ env.DIST_AMD64 }}/${{ env.DIST_AMD64 }},
${{ env.DIST_AMD64_DEB }}/${{ env.DIST_AMD64_DEB }},
${{ env.DIST_ARMV7 }}/${{ env.DIST_ARMV7 }},
${{ env.DIST_ARMV7_DEB }}/${{ env.DIST_ARMV7_DEB }},
${{ env.DIST_ARMV8 }}/${{ env.DIST_ARMV8 }},
${{ env.DIST_ARMV8_DEB }}/${{ env.DIST_ARMV8_DEB }}
build-linux-amd64:
needs: [ version ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: SSH connection to Actions
uses: P3TERX/[email protected]
if: (github.event.inputs.ssh_ubuntu == 'true' && github.event.inputs.ssh_ubuntu != 'false') || contains(github.event.action, 'ssh_ubuntu')
env:
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
- name: Build
id: compile
env:
VERSION: ${{ needs.version.outputs.version }}
STANDARD_VERSION: ${{ needs.version.outputs.standard_version }}
DIST_AMD64_DEB: ${{ needs.version.outputs.DIST_AMD64_DEB }}
DIST_AMD64: ${{ needs.version.outputs.DIST_AMD64 }}
run: |
echo $VERSION $STANDARD_VERSION $DIST_AMD64
docker run --rm -v "$(pwd):/src/" xfangfang/build-macast:amd64-220223 \
'pip install -r requirements.txt && \
pip install -U pyinstaller && \
python setup.py compile_catalog -f -D macast -d macast/i18n && \
export BUILD_LANG=$(for i in $(ls macast/i18n);do echo --add-data=macast/i18n/$i/LC_MESSAGES/*.mo:macast/i18n/$i/LC_MESSAGES; done) &&\
echo $BUILD_LANG
export BUILD_ASSETS=$(for i in $(ls macast/assets);do [ -d macast/assets/$i ] && echo --add-data=macast/assets/$i/*:macast/assets/$i; done) &&\
echo $BUILD_ASSETS &&\
pyinstaller --noconfirm -F -w \
--additional-hooks-dir=. \
$BUILD_LANG \
$BUILD_ASSETS \
--add-data="macast/xml/*:macast/xml" \
--add-data="macast/assets/*.png:macast/assets" \
--exclude-module=tkinter \
--distpath="app" \
Macast.py'
sudo chown 1000 app/Macast
cp app/Macast $DIST_AMD64
#build deb
mkdir -p dist/DEBIAN
mkdir -p dist/usr/bin
mkdir -p dist/usr/share/applications
mkdir -p dist/usr/share/icons/hicolor/128x128/apps
echo -e "Package: cn.xfangfang.macast\nVersion: ${STANDARD_VERSION}\nStandards-Version: ${STANDARD_VERSION}\nArchitecture: amd64\nMaintainer: xfangfang <[email protected]>\nSection:video\nDescription: DLNA Media Renderer\nDepends: mpv" > dist/DEBIAN/control
echo -e "[Desktop Entry]\nName=Macast\nComment=DLNA Media Renderer\nTryExec=mpv\nExec=/usr/bin/macast\nIcon=/usr/share/icons/hicolor/128x128/apps/macast.png\nTerminal=false\nType=Application\nCategories=AudioVideo;Audio;Video;Player;TV;" > dist/usr/share/applications/macast.desktop
cp app/Macast dist/usr/bin/macast
cp macast/assets/icon.png dist/usr/share/icons/hicolor/128x128/apps/macast.png
dpkg -b dist $DIST_AMD64_DEB
echo "::set-output name=status::success"
- name: Upload dist linux x64
uses: actions/upload-artifact@v2
if: steps.compile.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_AMD64 }}
path: ${{ needs.version.outputs.DIST_AMD64 }}
- name: Upload dist deb
uses: actions/upload-artifact@v2
if: steps.compile.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_AMD64_DEB }}
path: ${{ needs.version.outputs.DIST_AMD64_DEB }}
build-linux-armv7:
needs: [ version ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build
id: compile
env:
VERSION: ${{ needs.version.outputs.version }}
STANDARD_VERSION: ${{ needs.version.outputs.standard_version }}
DIST_ARMV7: ${{ needs.version.outputs.DIST_ARMV7 }}
DIST_ARMV7_DEB: ${{ needs.version.outputs.DIST_ARMV7_DEB }}
run: |
echo $VERSION $STANDARD_VERSION $DIST_ARMV7
docker run --platform=linux/arm/v7 --rm -v "$(pwd):/src/" xfangfang/build-macast:armv7-220223 \
'python setup.py compile_catalog -f -D macast -d macast/i18n && \
export BUILD_LANG=$(for i in $(ls macast/i18n);do echo --add-data=macast/i18n/$i/LC_MESSAGES/*.mo:macast/i18n/$i/LC_MESSAGES; done) &&\
echo $BUILD_LANG
export BUILD_ASSETS=$(for i in $(ls macast/assets);do [ -d macast/assets/$i ] && echo --add-data=macast/assets/$i/*:macast/assets/$i; done) &&\
echo $BUILD_ASSETS && \
pyinstaller --noconfirm -F -w \
--noupx \
--additional-hooks-dir=. \
$BUILD_LANG \
$BUILD_ASSETS \
--add-data="macast/xml/*:macast/xml" \
--add-data="macast/assets/*.png:macast/assets" \
--exclude-module=tkinter \
--distpath="app" \
Macast.py'
sudo chown 1000 app/Macast
cp app/Macast $DIST_ARMV7
#build deb
mkdir -p dist/DEBIAN
mkdir -p dist/usr/bin
mkdir -p dist/usr/share/applications
mkdir -p dist/usr/share/icons/hicolor/128x128/apps
echo -e "Package: Macast\nVersion: ${STANDARD_VERSION}\nStandards-Version: ${STANDARD_VERSION}\nArchitecture: armhf\nMaintainer: xfangfang <[email protected]>\nDescription: DLNA Media Renderer\nDepends: mpv" > dist/DEBIAN/control
echo -e "[Desktop Entry]\nName=Macast\nComment=DLNA Media Renderer\nTryExec=mpv\nExec=/usr/bin/macast\nIcon=/usr/share/icons/hicolor/128x128/apps/macast.png\nTerminal=false\nType=Application\nCategories=AudioVideo;Audio;Video;Player;TV;" > dist/usr/share/applications/macast.desktop
cp app/Macast dist/usr/bin/macast
cp macast/assets/icon.png dist/usr/share/icons/hicolor/128x128/apps/macast.png
dpkg -b dist $DIST_ARMV7_DEB
echo "::set-output name=status::success"
- name: Upload dist linux
uses: actions/upload-artifact@v2
if: steps.compile.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_ARMV7 }}
path: ${{ needs.version.outputs.DIST_ARMV7 }}
- name: Upload dist deb
uses: actions/upload-artifact@v2
if: steps.compile.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_ARMV7_DEB }}
path: ${{ needs.version.outputs.DIST_ARMV7_DEB }}
build-linux-armv8:
needs: [ version ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build
id: compile
env:
VERSION: ${{ needs.version.outputs.version }}
STANDARD_VERSION: ${{ needs.version.outputs.standard_version }}
DIST_ARMV8: ${{ needs.version.outputs.DIST_ARMV8 }}
DIST_ARMV8_DEB: ${{ needs.version.outputs.DIST_ARMV8_DEB }}
run: |
echo $VERSION $STANDARD_VERSION $DIST_ARMV8
docker run --platform=linux/arm64/v8 --rm -v "$(pwd):/src/" xfangfang/build-macast:armv8-220703 \
'python setup.py compile_catalog -f -D macast -d macast/i18n && \
export BUILD_LANG=$(for i in $(ls macast/i18n);do echo --add-data=macast/i18n/$i/LC_MESSAGES/*.mo:macast/i18n/$i/LC_MESSAGES; done) &&\
echo $BUILD_LANG
export BUILD_ASSETS=$(for i in $(ls macast/assets);do [ -d macast/assets/$i ] && echo --add-data=macast/assets/$i/*:macast/assets/$i; done) &&\
echo $BUILD_ASSETS && \
pyinstaller --noconfirm -F -w \
--noupx \
--additional-hooks-dir=. \
$BUILD_LANG \
$BUILD_ASSETS \
--add-data="macast/xml/*:macast/xml" \
--add-data="macast/assets/*.png:macast/assets" \
--exclude-module=tkinter \
--distpath="app" \
Macast.py'
sudo chown 1000 app/Macast
cp app/Macast $DIST_ARMV8
#build deb
mkdir -p dist/DEBIAN
mkdir -p dist/usr/bin
mkdir -p dist/usr/share/applications
mkdir -p dist/usr/share/icons/hicolor/128x128/apps
echo -e "Package: Macast\nVersion: ${STANDARD_VERSION}\nStandards-Version: ${STANDARD_VERSION}\nArchitecture: arm64\nMaintainer: xfangfang <[email protected]>\nDescription: DLNA Media Renderer\nDepends: mpv" > dist/DEBIAN/control
echo -e "[Desktop Entry]\nName=Macast\nComment=DLNA Media Renderer\nTryExec=mpv\nExec=/usr/bin/macast\nIcon=/usr/share/icons/hicolor/128x128/apps/macast.png\nTerminal=false\nType=Application\nCategories=AudioVideo;Audio;Video;Player;TV;" > dist/usr/share/applications/macast.desktop
cp app/Macast dist/usr/bin/macast
cp macast/assets/icon.png dist/usr/share/icons/hicolor/128x128/apps/macast.png
dpkg -b dist $DIST_ARMV8_DEB
echo "::set-output name=status::success"
- name: Upload dist linux
uses: actions/upload-artifact@v2
if: steps.compile.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_ARMV8 }}
path: ${{ needs.version.outputs.DIST_ARMV8 }}
- name: Upload dist deb
uses: actions/upload-artifact@v2
if: steps.compile.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_ARMV8_DEB }}
path: ${{ needs.version.outputs.DIST_ARMV8_DEB }}
build-win-x86:
needs: [ version ]
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7.9'
architecture: 'x86'
- name: Install Requirement
run: |
choco install upx
pip3 install -r requirements.txt
pip3 install pyinstaller
$client = new-object System.Net.WebClient
$client.DownloadFile('https://github.com/xfangfang/Macast/releases/download/v0.1/mpv-0.34.0-i686.7z','mpv.7z')
7z x -obin mpv.7z *.exe
- name: Build
id: compile
run: |
$VERSION="${{ needs.version.outputs.version }}"
$DIST_EXE32_DEBUG="${{ needs.version.outputs.DIST_EXE32_DEBUG }}"
$DIST_EXE32="${{ needs.version.outputs.DIST_EXE32 }}"
echo $VERSION $DIST_EXE32
python3 setup.py compile_catalog -f -D macast -d macast\i18n
$BUILD_LANG=(ls macast\i18n | ForEach-Object {echo --add-data="macast\i18n\$($_.Name)\LC_MESSAGES\*.mo;macast\i18n\$($_.Name)\LC_MESSAGES"})
$BUILD_ASSETS_1=(ls macast\assets | ?{$_.PsIsContainer -eq $true} | ForEach-Object {echo --add-data="macast\assets\$($_.Name)\*;macast\assets\$($_.Name)"})
$BUILD_ASSETS_2=("--add-data=macast\assets\*;macast\assets","--add-data=macast\xml\*;macast\xml","--add-binary=bin\mpv.exe;bin")
$BUILD_HIDDEN_IMPORT=("--hidden-import=win32process","--hidden-import=win32gui")
$BUILD_OTHERS=("--additional-hooks-dir=.","--icon=macast\assets\icon.ico","--runtime-tmpdir=%Temp%\Macast", "--upx-exclude=mpv.exe")
$BUILD_COMMON=($BUILD_LANG+$BUILD_ASSETS_1+$BUILD_ASSETS_2+$BUILD_HIDDEN_IMPORT+$BUILD_OTHERS)
pyinstaller --noconfirm -F -w $BUILD_COMMON --splash=macast\assets\macast_splash.jpg Macast.py
cp dist\Macast.exe ${DIST_EXE32}
pyinstaller --noconfirm -F -d=all $BUILD_COMMON Macast.py
cp dist\Macast.exe ${DIST_EXE32_DEBUG}
echo "::set-output name=status::success"
- name: Upload dist
uses: actions/upload-artifact@v2
if: steps.compile.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_EXE32 }}
path: ${{ needs.version.outputs.DIST_EXE32 }}
- name: Upload dist debug
uses: actions/upload-artifact@v2
if: steps.compile.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_EXE32_DEBUG }}
path: ${{ needs.version.outputs.DIST_EXE32_DEBUG }}
build-win-x64:
needs: [ version ]
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Requirement
run: |
choco install upx
pip3 install -r requirements.txt
pip3 install pyinstaller
$client = new-object System.Net.WebClient
$client.DownloadFile('https://github.com/xfangfang/Macast/releases/download/v0.1/mpv-0.34.0-x86_64.7z','mpv.7z')
7z x -obin mpv.7z *.exe
- name: Build
id: compile
run: |
$VERSION="${{ needs.version.outputs.version }}"
$DIST_EXE_DEBUG="${{ needs.version.outputs.DIST_EXE_DEBUG }}"
$DIST_EXE="${{ needs.version.outputs.DIST_EXE }}"
echo ${VERSION} ${DIST_EXE}
python3 setup.py compile_catalog -f -D macast -d macast\i18n
$BUILD_LANG=(ls macast\i18n | ForEach-Object {echo --add-data="macast\i18n\$($_.Name)\LC_MESSAGES\*.mo;macast\i18n\$($_.Name)\LC_MESSAGES"})
$BUILD_ASSETS_1=(ls macast\assets | ?{$_.PsIsContainer -eq $true} | ForEach-Object {echo --add-data="macast\assets\$($_.Name)\*;macast\assets\$($_.Name)"})
$BUILD_ASSETS_2=("--add-data=macast\assets\*;macast\assets","--add-data=macast\xml\*;macast\xml","--add-binary=bin\mpv.exe;bin")
$BUILD_HIDDEN_IMPORT=("--hidden-import=win32process","--hidden-import=win32gui")
$BUILD_OTHERS=("--additional-hooks-dir=.","--icon=macast\assets\icon.ico","--runtime-tmpdir=%Temp%\Macast", "--upx-exclude=mpv.exe")
$BUILD_COMMON=($BUILD_LANG+$BUILD_ASSETS_1+$BUILD_ASSETS_2+$BUILD_HIDDEN_IMPORT+$BUILD_OTHERS)
pyinstaller --noconfirm -F -w $BUILD_COMMON --splash=macast\assets\macast_splash.jpg Macast.py
cp dist\Macast.exe $DIST_EXE
pyinstaller --noconfirm -F -d=all $BUILD_COMMON Macast.py
cp dist\Macast.exe $DIST_EXE_DEBUG
echo "::set-output name=status::success"
- name: Upload dist
uses: actions/upload-artifact@v2
if: steps.compile.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_EXE }}
path: ${{ needs.version.outputs.DIST_EXE }}
- name: Upload dist debug
uses: actions/upload-artifact@v2
if: steps.compile.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_EXE_DEBUG }}
path: ${{ needs.version.outputs.DIST_EXE_DEBUG }}
build-macos-intel:
needs: [ version ]
runs-on: macos-11
steps:
- name: Checkout
uses: actions/checkout@v2
- name: install create-dmg
run: brew install create-dmg
- name: install universal python
run: |
wget https://www.python.org/ftp/python/3.9.8/python-3.9.8-macos11.pkg
sudo installer -pkg python-3.9.8-macos11.pkg -target /
- name: Install Requirement
run: |
pip3 install -r requirements.txt
pip3 install py2app
wget https://laboratory.stolendata.net/~djinn/mpv_osx/mpv-latest.tar.gz
mkdir -p bin && tar --strip-components 2 -C bin -xzvf mpv-latest.tar.gz mpv.app/Contents/MacOS
- name: Readme
run: |
mkdir -p dist
echo "Macast" > dist/readme.txt
echo "" >> dist/readme.txt
echo "if you see any of these after open this application:" >> dist/readme.txt
echo "1: Macast.app is damaged and can't be opened. You should move it to he Trash." >> dist/readme.txt
echo "2: Macast.app can't be opened because it is from an unidentified developer." >> dist/readme.txt
echo "" >> dist/readme.txt
echo "Please run this command in your terminal:" >> dist/readme.txt
echo "sudo xattr -rd com.apple.quarantine /Applications/Macast.app" >> dist/readme.txt
- name: SSH connection to Actions
uses: P3TERX/[email protected]
if: (github.event.inputs.ssh_darwin == 'true' && github.event.inputs.ssh_darwin != 'false') || contains(github.event.action, 'ssh_darwin')
env:
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
- name: Build
id: compile
env:
VERSION: ${{ needs.version.outputs.version }}
DIST_DMG: ${{ needs.version.outputs.DIST_DMG }}
run: |
echo $VERSION $DIST_DMG
python3 setup.py compile_catalog -f -D macast -d macast/i18n
python3 setup_py2app.py py2app --arch=x86_64
cp -R bin dist/Macast.app/Contents/Resources/
create-dmg --window-pos 200 120 --window-size 800 400 --icon-size 100 --icon "Macast.app" 200 190 --icon "readme.txt" 400 100 --hide-extension "Macast.app" --app-drop-link 600 185 --volname "Macast-v${VERSION} Installer" ${DIST_DMG} "dist/"
echo "::set-output name=status::success"
- name: Upload dist
uses: actions/upload-artifact@v2
if: steps.compile.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_DMG }}
path: ${{ needs.version.outputs.DIST_DMG }}
build-macos-apple:
needs: [ version ]
runs-on: macos-11
steps:
- name: Checkout
uses: actions/checkout@v2
- name: install create-dmg
run: brew install create-dmg
- name: install universal python
run: |
wget https://www.python.org/ftp/python/3.9.8/python-3.9.8-macos11.pkg
sudo installer -pkg python-3.9.8-macos11.pkg -target /
- name: Install Requirement
run: |
pip3 install -r requirements.txt
pip3 install py2app
wget https://github.com/xfangfang/Macast/releases/download/v0.1/mpv-0.34.1-darwin-arm.tar.gz
mkdir -p bin_arm && tar --strip-components 2 -C bin_arm -xzvf mpv-0.34.1-darwin-arm.tar.gz mpv.app/Contents/MacOS
wget https://github.com/xfangfang/Macast/releases/download/v0.1/macos_arm_lxml_netifaces.tar.gz
- name: Readme
run: |
mkdir -p dist
echo "Macast" > dist/readme.txt
echo "" >> dist/readme.txt
echo "if you see any of these after open this application:" >> dist/readme.txt
echo "1: Macast.app is damaged and can't be opened. You should move it to he Trash." >> dist/readme.txt
echo "2: Macast.app can't be opened because it is from an unidentified developer." >> dist/readme.txt
echo "" >> dist/readme.txt
echo "Please run this command in your terminal:" >> dist/readme.txt
echo "sudo xattr -rd com.apple.quarantine /Applications/Macast.app" >> dist/readme.txt
- name: SSH connection to Actions
uses: P3TERX/[email protected]
if: (github.event.inputs.ssh_darwin == 'true' && github.event.inputs.ssh_darwin != 'false') || contains(github.event.action, 'ssh_darwin')
env:
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
- name: Build arm
id: compile_arm
env:
VERSION: ${{ needs.version.outputs.version }}
DIST_DMG_ARM: ${{ needs.version.outputs.DIST_DMG_ARM }}
run: |
echo $VERSION $DIST_DMG_ARM
python3 setup.py compile_catalog -f -D macast -d macast/i18n
python3 setup_py2app.py py2app --arch=arm64
cp -R bin_arm dist/Macast.app/Contents/Resources/bin
tar --strip-components 1 -C dist/Macast.app/Contents/Resources/lib/python3.9/lib-dynload -xzvf macos_arm_lxml_netifaces.tar.gz
create-dmg --window-pos 200 120 --window-size 800 400 --icon-size 100 --icon "Macast.app" 200 190 --icon "readme.txt" 400 100 --hide-extension "Macast.app" --app-drop-link 600 185 --volname "Macast-v${VERSION} Installer" ${DIST_DMG_ARM} "dist/"
echo "::set-output name=status::success"
- name: Upload dist arm
uses: actions/upload-artifact@v2
if: steps.compile_arm.outputs.status == 'success'
with:
name: ${{ needs.version.outputs.DIST_DMG_ARM }}
path: ${{ needs.version.outputs.DIST_DMG_ARM }}