Build Window #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Window | |
| # Manual-only. Trigger from the Actions tab → "Build Window" → "Run workflow". | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_mode: | |
| description: "Where to publish the build" | |
| required: true | |
| default: "artifact-only" | |
| type: choice | |
| options: | |
| - artifact-only | |
| - draft | |
| - release | |
| - nightly | |
| version_tag: | |
| description: "Tag for draft / release modes (e.g. v0.2.0). Ignored for artifact-only / nightly." | |
| required: false | |
| default: "" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build SciKMS.exe | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Sync dependencies (with pyinstaller) | |
| run: uv sync --dev --python 3.12 | |
| - name: Capture version | |
| shell: bash | |
| run: | | |
| echo "SCIKMS_VERSION=$(uv run python -c 'import scikms; print(scikms.__version__)')" >> "$GITHUB_ENV" | |
| - name: Bundle via PyInstaller | |
| run: uv run pyinstaller --noconfirm scikms.spec | |
| - name: Zip the bundle | |
| shell: bash | |
| run: | | |
| cd dist | |
| BASENAME="SciKMS-${SCIKMS_VERSION}-windows-x64" | |
| powershell -Command "Compress-Archive -Path SciKMS -DestinationPath ${BASENAME}.zip" | |
| ls -lh "${BASENAME}.zip" | |
| echo "SCIKMS_ZIP=${BASENAME}.zip" >> "$GITHUB_ENV" | |
| - name: Upload build artifact (always) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.SCIKMS_ZIP }} | |
| path: dist/${{ env.SCIKMS_ZIP }} | |
| retention-days: 30 | |
| - name: Publish to GitHub Release (draft / release) | |
| if: inputs.release_mode == 'draft' || inputs.release_mode == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ inputs.version_tag }} | |
| name: ${{ inputs.version_tag }} | |
| draft: ${{ inputs.release_mode == 'draft' }} | |
| files: dist/${{ env.SCIKMS_ZIP }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to nightly Release | |
| if: inputs.release_mode == 'nightly' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: nightly | |
| name: Nightly builds | |
| prerelease: true | |
| files: dist/${{ env.SCIKMS_ZIP }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |