-
Notifications
You must be signed in to change notification settings - Fork 8
113 lines (96 loc) · 3.43 KB
/
build_exe.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
name: Build Executables
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+-?*"
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- platform_name: Windows
artifact_name: windows
os: windows-2022
version_command: icacls "VERSION" /grant Everyone:F /T /C /Q
move_command: move dist\mangotango.exe dist\mangotango_windows.exe
sha_command: pwsh -c "Get-FileHash -Algorithm SHA1 dist\mangotango_windows.exe | Format-Table Hash -HideTableHeaders > dist\mangotango_windows.exe.sha1"
list_command: dir dist
- platform_name: MacOS 14
artifact_name: macos-14
os: macos-14
move_command: mv dist/mangotango dist/mangotango_macos_14
sha_command: shasum -a 1 dist/mangotango_macos_14 > dist/mangotango_macos_14.sha1
list_command: ls -ll dist
- platform_name: MacOS 15
artifact_name: macos-15
os: macos-15
move_command: mv dist/mangotango dist/mangotango_macos_15
sha_command: shasum -a 1 dist/mangotango_macos_15 > dist/mangotango_macos_15.sha1
list_command: ls -ll dist
name: Build ${{ matrix.platform_name }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/pip
key: ${{ matrix.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ matrix.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install PyInstaller
run: pip install pyinstaller
- name: Print version string (for tag)
id: get_version_tag
if: ${{ github.ref_type == 'tag' }}
run: |
python -c "with open('VERSION', 'w', encoding='utf-8') as f: f.write('${{ github.ref_name }}')"
- name: Print version string (for branch)
id: get_version_branch
if: ${{ github.ref_type != 'tag' }}
run: |
python -c "with open('VERSION', 'w', encoding='utf-8') as f: f.write('${{ github.ref_name }}-${{ github.sha }}')"
- name: Modify version string permission
if: ${{ matrix.version_command }}
run: ${{ matrix.version_command }}
- name: Build the executable
run: |
pyinstaller pyinstaller.spec
- name: Rename the executable to include platform suffix
run: ${{ matrix.move_command }}
- name: Compute the SHA1 hashsum
run: ${{ matrix.sha_command }}
- name: Inspect the dist/ directory before uploading artifacts
run: ${{ matrix.list_command }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: |
dist/*
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/**/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}