Repository navigation
189 lines (159 loc) · 5.03 KB
/
Copy pathbuild.yml
File metadata and controls
189 lines (159 loc) · 5.03 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
name: Build Distributables
on:
push:
tags:
- '*'
# Required for creating GitHub Releases.
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install pyinstaller -r requirements.txt
# ---------------------------------------------------------
# macOS
# ---------------------------------------------------------
- name: Build for macOS
if: matrix.os == 'macos-latest'
shell: bash
run: |
pip install pillow
pyinstaller \
--onefile \
--name Scriptify \
--icon web/favicon.ico \
--collect-all onnx_asr \
--add-data "web:web" \
--add-data "js:js" \
--add-data "index.html:." \
--add-data "launch.html:." \
--add-data "style.css:." \
--osx-bundle-identifier com.infinitode.scriptify \
--windowed \
main.py
# ---------------------------------------------------------
# Linux
# ---------------------------------------------------------
- name: Build for Linux
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y upx
pyinstaller \
--onefile \
--clean \
--strip \
--name Scriptify \
--icon web/favicon.ico \
--collect-all onnx_asr \
--exclude-module tkinter \
--exclude-module PyQt5 \
--add-data "web:web" \
--add-data "js:js" \
--add-data "index.html:." \
--add-data "launch.html:." \
--add-data "style.css:." \
--windowed \
main.py \
--upx-dir /usr/bin
strip dist/Scriptify
# ---------------------------------------------------------
# Windows
# ---------------------------------------------------------
- name: Build for Windows
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
pyinstaller `
--onefile `
--name Scriptify `
--icon web/favicon.ico `
--collect-all onnx_asr `
--add-data "web;web" `
--add-data "js;js" `
--add-data "index.html;." `
--add-data "launch.html;." `
--add-data "style.css;." `
--windowed `
main.py `
--version-file version_info.txt
# ---------------------------------------------------------
# Upload build artifact
# ---------------------------------------------------------
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Scriptify-${{ matrix.os }}
path: |
dist/Scriptify
dist/Scriptify.exe
if-no-files-found: error
# =============================================================
# Release
# =============================================================
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: Scriptify-ubuntu-latest
path: release/linux
- name: Download macOS artifact
uses: actions/download-artifact@v4
with:
name: Scriptify-macos-latest
path: release/macos
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: Scriptify-windows-latest
path: release/windows
- name: Prepare release files
shell: bash
run: |
mkdir -p release/final
mv release/linux/Scriptify \
release/final/Scriptify-linux
mv release/macos/Scriptify \
release/final/Scriptify-macos
mv release/windows/Scriptify.exe \
release/final/Scriptify-windows.exe
chmod +x release/final/Scriptify-linux
chmod +x release/final/Scriptify-macos
ls -lah release/final
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${{ github.ref_name }}" \
release/final/Scriptify-linux \
release/final/Scriptify-macos \
release/final/Scriptify-windows.exe \
--repo "${{ github.repository }}" \
--title "Scriptify ${{ github.ref_name }}" \
--generate-notes