11name : Build Bangen (Nuitka)
2-
32on :
43 push :
54 tags :
65 - " v*"
76 workflow_dispatch :
8-
97jobs :
108 build :
119 strategy :
1210 matrix :
1311 os : [ubuntu-latest, macos-latest, windows-latest]
14-
1512 runs-on : ${{ matrix.os }}
16-
1713 steps :
1814 - name : Checkout
1915 uses : actions/checkout@v4
20-
2116 - name : Extract version (Unix)
2217 id : vars_unix
2318 if : runner.os != 'Windows'
2419 run : echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
25-
2620 - name : Extract version (Windows)
2721 id : vars_win
2822 if : runner.os == 'Windows'
2923 shell : pwsh
3024 run : |
3125 $version = $env:GITHUB_REF_NAME -replace '^v', ''
3226 echo "VERSION=$version" >> $env:GITHUB_OUTPUT
33-
3427 - name : Resolve version
3528 id : vars
3629 shell : bash
@@ -40,41 +33,37 @@ jobs:
4033 else
4134 echo "VERSION=${{ steps.vars_unix.outputs.VERSION }}" >> $GITHUB_OUTPUT
4235 fi
43-
4436 - name : Setup Python
4537 uses : actions/setup-python@v5
4638 with :
4739 python-version : " 3.11"
48-
4940 - name : Install system dependencies (Linux)
5041 if : runner.os == 'Linux'
5142 run : |
5243 sudo apt-get update
5344 sudo apt-get install -y build-essential
54-
5545 - name : Ensure Xcode CLI tools (macOS)
5646 if : runner.os == 'macOS'
5747 run : |
5848 xcode-select -p || xcode-select --install || true
59-
6049 - name : Install MSVC build tools (Windows)
6150 if : runner.os == 'Windows'
6251 uses : ilammy/msvc-dev-cmd@v1
63-
6452 - name : Cache Nuitka
6553 uses : actions/cache@v4
6654 with :
6755 path : |
6856 ~/.cache/Nuitka
57+ ~/Library/Caches/Nuitka
6958 ~\AppData\Local\Nuitka\Nuitka\Cache
7059 key : nuitka-${{ runner.os }}-${{ hashFiles('**/*.py') }}
71-
60+ restore-keys : |
61+ nuitka-${{ runner.os }}-
7262 - name : Install Python dependencies
7363 run : |
7464 python -m pip install --upgrade pip
7565 pip install nuitka[onefile]
7666 pip install .
77-
7867 - name : Create entry point script
7968 shell : bash
8069 run : |
8372 if __name__ == "__main__":
8473 main()
8574 EOF
86-
8775 - name : Build with Nuitka (Unix)
8876 if : runner.os != 'Windows'
8977 run : |
@@ -113,7 +101,6 @@ jobs:
113101 --onefile-tempdir-spec={CACHE_DIR}/bangen/${{ steps.vars.outputs.VERSION }} \
114102 --static-libpython=yes \
115103 _entry.py
116-
117104 - name : Build with Nuitka (Windows)
118105 if : runner.os == 'Windows'
119106 shell : pwsh
@@ -143,7 +130,6 @@ jobs:
143130 --python-flag=isolated `
144131 "--onefile-tempdir-spec={CACHE_DIR}/bangen/${{ steps.vars.outputs.VERSION }}" `
145132 _entry.py
146-
147133 - name : Prepare artifacts (Unix)
148134 if : runner.os != 'Windows'
149135 run : |
@@ -153,39 +139,33 @@ jobs:
153139 else
154140 mv build/bangen dist/bangen-${{ steps.vars.outputs.VERSION }}-macos
155141 fi
156-
157142 - name : Prepare artifacts (Windows)
158143 if : runner.os == 'Windows'
159144 shell : pwsh
160145 run : |
161146 New-Item -ItemType Directory -Force -Path dist
162147 Move-Item build\bangen.exe dist\bangen-${{ steps.vars.outputs.VERSION }}-windows.exe
163-
164148 - name : Strip binary (Linux only)
165149 if : runner.os == 'Linux'
166150 run : strip dist/bangen-${{ steps.vars.outputs.VERSION }}-linux
167-
168151 - name : Upload artifacts
169152 uses : actions/upload-artifact@v4
170153 with :
171154 name : bangen-${{ runner.os }}
172155 path : dist/*
173-
174156 release :
175157 needs : build
176158 runs-on : ubuntu-latest
177- if : startsWith(github.ref, 'refs/tags/')
178-
159+ # FIX: also runs when manually dispatched, not only on tag pushes
160+ if : startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
179161 steps :
180162 - name : Extract version
181163 id : vars
182164 run : echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
183-
184165 - name : Download artifacts
185166 uses : actions/download-artifact@v4
186167 with :
187168 path : artifacts
188-
189169 - name : Create GitHub Release
190170 uses : softprops/action-gh-release@v2
191171 with :
0 commit comments