-
Notifications
You must be signed in to change notification settings - Fork 7
181 lines (175 loc) · 6 KB
/
main.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
name: Build and Package App
on:
push:
branches:
- main
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install VLC
run: sudo apt-get install -y vlc
- name: Install dependencies
run: pip install -r requirements.txt
- name: Package App with PyInstaller for Linux
run: |
pip install pyinstaller
pyinstaller qitv-linux.spec
- name: Upload Linux artifact
uses: actions/upload-artifact@v3
with:
name: packaged-app-linux
path: dist/qitv
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install VLC
run: choco install vlc -y
- name: Install dependencies
run: pip install -r requirements.txt
- name: Package App with PyInstaller for Windows
run: |
pip install pyinstaller
pyinstaller qitv-windows.spec
- name: Upload Windows artifact
uses: actions/upload-artifact@v3
with:
name: packaged-app-windows
path: dist/qitv.exe
build-macos-universal:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install VLC
run: brew install --cask vlc
- name: Install dependencies
run: pip install -r requirements.txt
- name: Package App with PyInstaller for macOS
run: |
pip install pyinstaller
pyinstaller qitv-macos.spec
- name: Rename the executable
run: mv dist/qitv.app/Contents/MacOS/qitv dist/qitv.app/Contents/MacOS/qitv_cli
- name: Create launcher script
run: |
printf '#!/bin/bash\nopen -n "$(dirname "$0")/qitv_cli"\n' > dist/qitv.app/Contents/MacOS/qitv
chmod +x dist/qitv.app/Contents/MacOS/qitv
- name: Ad-Hoc Sign the app
run: codesign --force --deep --sign - dist/qitv.app
- name: Zip macOS App
run: |
cd dist
zip -r qitv-macos-universal.zip qitv.app
- name: Upload macOS artifact
uses: actions/upload-artifact@v3
with:
name: packaged-app-macos-universal
path: dist/qitv-macos-universal.zip
build-macos-intel:
runs-on: macos-11
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install VLC
run: brew install --cask vlc
- name: Install dependencies
run: pip install -r requirements.txt
- name: Package App with PyInstaller for macOS (Intel)
run: |
pip install pyinstaller
pyinstaller qitv-macos.spec
- name: Rename the executable
run: mv dist/qitv.app/Contents/MacOS/qitv dist/qitv.app/Contents/MacOS/qitv_cli
- name: Create launcher script
run: |
printf '#!/bin/bash\nopen -n "$(dirname "$0")/qitv_cli"\n' > dist/qitv.app/Contents/MacOS/qitv
chmod +x dist/qitv.app/Contents/MacOS/qitv
- name: Ad-Hoc Sign the app
run: codesign --force --deep --sign - dist/qitv.app
- name: Zip macOS App
run: |
cd dist
zip -r qitv-macos-intel.zip qitv.app
- name: Upload macOS artifact
uses: actions/upload-artifact@v3
with:
name: packaged-app-macos-intel
path: dist/qitv-macos-intel.zip
release:
needs: [build-linux, build-windows, build-macos-universal, build-macos-intel]
runs-on: ubuntu-latest
steps:
- name: Get shortened SHA
id: short-sha
run: |
echo ${GITHUB_SHA:0:7} > short_sha.txt
echo "SHORT_SHA=$(cat short_sha.txt)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: release-${{ env.SHORT_SHA }}
release_name: Release ${{ env.SHORT_SHA }}
draft: false
prerelease: false
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Upload Linux Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: packaged-app-linux/qitv
asset_name: qitv-linux
asset_content_type: application/octet-stream
- name: Upload Windows Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: packaged-app-windows/qitv.exe
asset_name: qitv-windows.exe
asset_content_type: application/octet-stream
- name: Upload macOS Universal Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: packaged-app-macos-universal/qitv-macos-universal.zip
asset_name: qitv-macos-universal.zip
asset_content_type: application/zip
- name: Upload macOS Intel Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: packaged-app-macos-intel/qitv-macos-intel.zip
asset_name: qitv-macos-intel.zip
asset_content_type: application/zip