-
Notifications
You must be signed in to change notification settings - Fork 7
215 lines (209 loc) · 7.93 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
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
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: Check OpenSSL Version
run: python -c "import ssl; print(ssl.OPENSSL_VERSION)"
- name: Install VLC
run: sudo apt-get update && 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: Check OpenSSL Version
run: python -c "import ssl; print(ssl.OPENSSL_VERSION)"
# - name: Install Chocolatey
# shell: powershell
# run: |
# Set-ExecutionPolicy Bypass -Scope Process -Force
# [System.Net.ServicePointManager]::SecurityProtocol = 'Tls12'
# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
- name: Install VLC using Chocolatey
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: Check OpenSSL Version
run: python -c "import ssl; print(ssl.OPENSSL_VERSION)"
- 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-12
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Check OpenSSL Version
run: python -c "import ssl; print(ssl.OPENSSL_VERSION)"
- 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: Checkout code
uses: actions/checkout@v4
- name: Get Version
id: get_version
run: |
version=$(grep -oP '(?<=CURRENT_VERSION = ")[^"]*' config_manager.py)
echo "VERSION=$version" >> $GITHUB_ENV
- name: Get Previous Version
id: get_previous_version
run: |
previous_version=$(git tag --sort=-v:refname | head -n 2 | tail -n 1)
echo "PREVIOUS_VERSION=$previous_version" >> $GITHUB_ENV
- name: Generate Changelog
id: generate_changelog
run: |
echo "## Please always download this free software from [RELEASES](https://github.com/ozankaraali/QiTV/releases) instead of using others' distributions, which may have malware. Always keep the [original repository](https://github.com/ozankaraali/QiTV) for the reference." > changelog.md
echo "" >> changelog.md
echo "Security updates." >> changelog.md
echo "" >> changelog.md
echo "**Full Changelog**: https://github.com/ozankaraali/QiTV/compare/${{ env.PREVIOUS_VERSION }}...v${{ env.VERSION }}" >> changelog.md
echo "" >> changelog.md
echo "### Commits" >> changelog.md
echo "" >> changelog.md
git log --pretty=format:"- %s" ${{ env.PREVIOUS_VERSION }}...HEAD >> changelog.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: v${{ env.VERSION }}
body: ${{ steps.generate_changelog.outputs.changelog }}
draft: false
prerelease: true
- 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