-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.yml
More file actions
80 lines (66 loc) · 1.91 KB
/
main.yml
File metadata and controls
80 lines (66 loc) · 1.91 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
name: Build and Release Executables
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
env:
MAIN_PY_FILE: main.pyw
APP_NAME: main
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10.x'
cache: pip
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Install PyInstaller
run: pip install pyinstaller
- name: Build executable
run: |
pyinstaller --clean --onefile ${{ env.MAIN_PY_FILE }}
- name: Rename Executable for Release
shell: bash
run: |
if [ "${{ matrix.os }}" == "windows-latest" ]; then
mv "dist/${APP_NAME}.exe" "dist/${APP_NAME}-${{ matrix.os }}.exe"
else
mv "dist/${APP_NAME}" "dist/${APP_NAME}-${{ matrix.os }}"
fi
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: executable-${{ matrix.os }}
path: dist/
compression-level: 0
release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
with:
path: dist-release/
merge-multiple: true
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_type == 'tag' && github.ref_name || 'latest' }}
name: ${{ github.ref_type == 'tag' && format('Release {0}', github.ref_name) || 'Latest Build' }}
draft: false
prerelease: false
generate_release_notes: true
files: dist-release/*