Skip to content

Commit 157eca2

Browse files
authored
[Merge] Add workflow to generate platform binaries
feat: Add workflow to generate platform binaries
2 parents 31fbd2e + a551986 commit 157eca2

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build for Linux
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
- published
8+
9+
jobs:
10+
build:
11+
name: Build for linux
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Install UPX
15+
run: |
16+
sudo apt-get update -y
17+
sudo apt-get install -y upx
18+
- uses: actions/checkout@v2
19+
- name: Install Python 3.8
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: 3.8
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements.txt
27+
- name: Build binary with PyInstaller
28+
run: pyinstaller app.py --onefile --clean --exclude-module tensorflow
29+
- name: Upload binary
30+
uses: actions/upload-release-asset@v1
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
with:
34+
upload_url: ${{ github.event.release.upload_url }}
35+
asset_path: ./dist/app
36+
asset_name: app
37+
asset_content_type: application/octet-stream
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build for Windows
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
- published
8+
9+
jobs:
10+
build:
11+
name: Build for windows (.exe)
12+
runs-on: windows-latest
13+
steps:
14+
- name: Install UPX
15+
run: choco install upx -y
16+
- uses: actions/checkout@v2
17+
- name: Install Python 3.8
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: 3.8
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -r requirements.txt
25+
- name: Build exe with PyInstaller
26+
run: pyinstaller app.py --onefile --clean --exclude-module tensorflow
27+
- name: Upload .exe
28+
uses: actions/upload-release-asset@v1
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
with:
32+
upload_url: ${{ github.event.release.upload_url }}
33+
asset_path: ./dist/app.exe
34+
asset_name: app.exe
35+
asset_content_type: application/vnd.microsoft.portable-executable

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ Flask==2.0.1
66

77
# requirements-dev
88
pre-commit==2.13.0
9+
PyInstaller==4.5.1
910
black
1011
autoflake

0 commit comments

Comments
 (0)