-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (99 loc) · 3.28 KB
/
build-release.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
name: Build Release
env:
NAME: cyberpunk2077-r6-config-editor
NAME_ZIPPED: cyberpunk2077-r6-config-editor.zip
on:
pull_request:
branches: [ main ]
push:
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
release:
types:
- edited
jobs:
test:
timeout-minutes: 30
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with: { python-version: '3.10' }
- run: pip -q install -r requirements.prod.lock -r requirements.dev.lock
- run: pytest
lint:
timeout-minutes: 30
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with: { python-version: '3.10' }
- run: pip -q install -r requirements.prod.lock -r requirements.dev.lock
- run: flake8 src tests
format:
timeout-minutes: 30
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with: { python-version: '3.10' }
- run: pip -q install -r requirements.prod.lock -r requirements.dev.lock
- run: black --check src tests
build:
timeout-minutes: 30
needs: [ test, lint, format ]
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with: { python-version: '3.10' }
- name: Build pyinstaller
run: |
python -m pip install --upgrade pip
pip install -r requirements.prod.lock
git clone --depth 1 --branch v4.6 https://github.com/pyinstaller/pyinstaller
cd .\pyinstaller\bootloader\
python ./waf all
cd ..
python setup.py install
- name: Build app
run: |
pyinstaller --onefile src\main.py --name ${env:NAME} --windowed --icon=logo.ico
md -Force dist; mv changelog.md dist; mv installation.md dist
Compress-Archive -Force -Path .\dist\* -DestinationPath ${env:NAME_ZIPPED}
- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.NAME }}-${{ github.sha }}
path: ${{ env.NAME_ZIPPED }}
release:
timeout-minutes: 30
needs: [ build ]
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: ${{ env.NAME }}-${{ github.sha }}
- name: Prepare zipped version filename
id: env
run: |
VERSION=$(echo $GITHUB_REF | awk -F / '{print $3}')
NAME_ZIPPED_VERSIONED="${NAME}_${VERSION}.zip"
mv ${NAME_ZIPPED} ${NAME_ZIPPED_VERSIONED}
echo ::set-output name=name-zipped-versioned::"${NAME_ZIPPED_VERSIONED}"
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload assets for stable release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ${{ steps.env.outputs.name-zipped-versioned }}
asset_name: ${{ steps.env.outputs.name-zipped-versioned }}
asset_content_type: application/zip