Publish GitHub releases on push to master, build on PRs #204
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 | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| architecture: x64 | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Cache Nuitka | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~\AppData\Local\Nuitka | |
| key: nuitka | |
| - name: Build | |
| run: | | |
| uv run nuitka --standalone --prefer-source-code --mingw64 --assume-yes-for-downloads --show-scons --output-dir=build --include-module=_cffi_backend src\snapjaw.py | |
| New-Item -ItemType directory -Name snapjaw\snapjaw -Path build | |
| Get-Item -Path build\snapjaw.dist\* | Move-Item -Destination build\snapjaw\snapjaw | |
| - name: Package | |
| run: Compress-Archive -Path build\snapjaw\* -DestinationPath snapjaw.zip | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: snapjaw | |
| path: snapjaw.zip | |
| release: | |
| needs: build | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: snapjaw | |
| - name: Get date | |
| id: date | |
| run: echo "date=$(date +%Y.%m.%d)" >> "$GITHUB_OUTPUT" | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.date.outputs.date }}.${{ github.run_number }} | |
| name: ${{ steps.date.outputs.date }}.${{ github.run_number }} | |
| files: snapjaw.zip |