71 lines
1.9 KiB
YAML
71 lines
1.9 KiB
YAML
name: Build & Release (Windows)
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch: {}
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-windows:
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
cache: 'pip'
|
|
|
|
- name: Install dependencies
|
|
shell: pwsh
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
python -m pip install -r requirements.txt
|
|
python -m pip install pyinstaller
|
|
|
|
- name: Stamp version (dev builds)
|
|
if: startsWith(github.ref, 'refs/heads/')
|
|
shell: pwsh
|
|
run: |
|
|
$sha = "${{ github.sha }}".Substring(0,7)
|
|
Set-Content -Path version.py -Value "__version__ = `"0.0.0.dev0+$sha`"`n" -Encoding utf8
|
|
|
|
- name: Stamp version (tag builds)
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
shell: pwsh
|
|
run: |
|
|
$tag = "${{ github.ref_name }}"
|
|
$ver = ($tag -replace '^v','')
|
|
Set-Content -Path version.py -Value "__version__ = `"$ver`"`n" -Encoding utf8
|
|
|
|
- name: Build (PyInstaller spec)
|
|
shell: pwsh
|
|
run: |
|
|
pyinstaller --noconfirm --clean main.spec
|
|
|
|
- name: Upload build artifact (push/dispatch)
|
|
if: startsWith(github.ref, 'refs/heads/') || github.event_name == 'workflow_dispatch'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: image_processor-windows
|
|
path: |
|
|
dist/**
|
|
|
|
- name: Create GitHub Release (tags)
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: ${{ github.ref_name }}
|
|
tag_name: ${{ github.ref_name }}
|
|
generate_release_notes: true
|
|
files: |
|
|
dist/**
|