-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (60 loc) · 2.07 KB
/
Build_Executable.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
name: Generate Python Executable for Windows
on:
workflow_dispatch:
inputs:
tag:
required: false
type: string
description: Override the version tag (leave empty to use version from __version__.py)
# on:
# workflow_dispatch: # manually triggered
# inputs:
# tag:
# required: true
# type: string
# description: the semver tag your release will have
jobs:
create-executable-and-release:
runs-on: windows-latest
permissions:
contents: write
defaults:
run:
working-directory: .
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.8.10"
- name: Install requirements
#working-directory: . # <your working directory> # can remove this field if your working directory is root
run: pip install -r requirements.txt
- name: Install Pyinstaller
run: pip install -U pyinstaller
- name: Compile executable
run: |
$env:PYTHONPATH = "$env:GITHUB_WORKSPACE;$env:PYTHONPATH"
pyinstaller --onefile --name sierra-status --hidden-import=sierra_status.__version__ --hidden-import=serial --hidden-import=argparse --add-data "sierra_status:sierra_status" .\sierra_status\src\cli.py
- name: Print __version__.py contents
run: |
Get-Content .\sierra_status\__version__.py
- name: Get version
id: get_version
run: |
$version = (Get-Content .\sierra_status\__version__.py | Select-String -Pattern "__version__\s*=\s*[\"'](.*)[\""']").Matches.Groups[1].Value
echo $version
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
- name: Check working directory
run: |
Get-Location
Get-ChildItem
- name: Release
uses: softprops/action-gh-release@v2
with:
files: dist/sierra-status.exe
tag_name: ${{ inputs.tag || format('v{0}', steps.get_version.outputs.VERSION) }}
- name: Print directory structure
run: |
Get-ChildItem -Recurse