-
Notifications
You must be signed in to change notification settings - Fork 264
155 lines (132 loc) · 4.53 KB
/
Copy pathbuild-windows.yml
File metadata and controls
155 lines (132 loc) · 4.53 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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Build for Windows x86_64
on:
push:
branches:
- 'build-release'
paths-ignore:
- 'doc/**'
- '*.md'
# - '.github/**'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_windows_x64:
runs-on: windows-2022
env:
PYTHONWARNDEFAULTENCODING: true
APPNAME: PyGlossary
DIST_DIR: dist.nuitka.tk
DEFAULT_UI: tk
MAIN_SCRIPT: main.py
RESOURCE_DIR: "resources"
steps:
- name: Check-out repository
uses: actions/checkout@v4
with:
submodules: true
# Number of commits to fetch, ootb only 1 commit
# 0 = all history for all branches and tags. (needed for git describe)
fetch-depth: 0
fetch-tags: true
# ref: build-release # comment out before merge!
- name: "Set up Python 3.13"
uses: actions/setup-python@v5
with:
python-version: '3.13'
# x64, or arm64
architecture: 'x64'
- name: Set environment variables
shell: bash
run: |
VERSION=$(git describe --abbrev=0 --tags || git describe)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION_WITH_HASH=$(git describe)" >> $GITHUB_ENV
echo "FILENAME_BASE=PyGlossary-${VERSION}-Windows-${RUNNER_ARCH}" >> $GITHUB_ENV
- name: "create and activate venv"
shell: cmd
run: python3 -m venv .venv && .venv\Scripts\activate.bat
- name: Patch sources for nuitka build
shell: cmd
run: python3 .github\scripts\win\patch_sources.py
- name: "install nuitka"
shell: cmd
run: python3 -m pip install nuitka
- name: "Install Dependencies"
shell: cmd
run: python3 .github\scripts\win\install-deps.py
- name: Nuitka build
env:
PYTHONWARNDEFAULTENCODING: 0
shell: cmd
run: python .github\scripts\win\nuitka-build.py
- name: Copy assets
shell: cmd
run: python3 .github\scripts\win\copy_assets.py
- name: Pack to zip before uploading
shell: cmd
working-directory: ${{ env.DIST_DIR }}\${{ env.APPNAME }}.dist
run: |
7z a -tzip ..\..\${{ env.FILENAME_BASE }}-dist.zip .
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context
name: ${{ env.FILENAME_BASE }}
if-no-files-found: error
path: |
${{ env.FILENAME_BASE }}-dist.zip
- name: Create Inno Installer
shell: cmd
run: >-
iscc .github/scripts/win/inno_setup.iss
/DMyAppVersion="${{ env.VERSION }}"
/DSourceFilesGlob="${{ github.workspace }}\${{ env.DIST_DIR }}\${{ env.APPNAME }}.dist\*"
/DLicenseFile="${{ github.workspace }}\LICENSE"
/O${{ github.workspace }}\Output
- name: Upload Inno Installer EXE
uses: actions/upload-artifact@v4
with:
name: ${{ env.FILENAME_BASE }}-installer
if-no-files-found: error
path: |
Output\*.exe
release:
if: true
needs: [build_windows_x64]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
# ref: build-release # comment out before merge
- name: Set release vars
run: |
echo "VERSION=$(git describe --abbrev=0)" >> $GITHUB_ENV
echo "VERSION_WITH_HASH=$(git describe)" >> $GITHUB_ENV
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
merge-multiple: true
- name: List generated artifacts
run: |
pwd
echo ${{ github.workspace }}/artifacts
find ${{ github.workspace }}/artifacts
- name: make release
uses: ncipollo/release-action@v1
# https://github.com/ncipollo/release-action
with:
name: ${{ env.VERSION }}
artifacts: "artifacts/*.zip,artifacts/*.exe"
artifactContentType: application/zip
generateReleaseNotes: true
makeLatest: true
allowUpdates: true
omitBodyDuringUpdate: true # preserve the existing body during updates:
tag: ${{ env.VERSION }}