Skip to content

Use supplier format wording in release art #21

Use supplier format wording in release art

Use supplier format wording in release art #21

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
windows:
name: Build Windows release
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
shell: pwsh
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[gui]"
python -m pip install pyinstaller pytest ruff
- name: Determine release version
shell: pwsh
run: |
$version = (python -c "import gpt2json; print(gpt2json.__version__)").Trim()
if (-not ($version -match '^\d+(\.\d+){1,3}$')) {
throw "Invalid release version from gpt2json.__version__: '$version'. Expected numeric form like 0.1.0."
}
if ("${{ github.ref_type }}" -eq "tag" -and "${{ github.ref_name }}" -ne "v$version") {
throw "Tag/version mismatch: ref is '${{ github.ref_name }}' but gpt2json.__version__ is '$version'."
}
"GPT2JSON_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
Write-Host "Release version: $version"
- name: Test
shell: pwsh
env:
QT_QPA_PLATFORM: offscreen
run: |
python -m pytest -q
python -m ruff check gpt2json tests scripts
python scripts/check_release.py
- name: Build portable GUI
shell: pwsh
run: |
.\packaging\windows\build-portable.ps1
- name: Install Inno Setup
shell: pwsh
run: |
choco install innosetup --no-progress -y
- name: Build Windows installer
shell: pwsh
run: |
.\packaging\windows\build-installer.ps1
- name: Pack release assets
shell: pwsh
run: |
New-Item -ItemType Directory -Force release | Out-Null
Get-ChildItem release -Filter "GPT2JSON-ArtSetup-v*.exe" -ErrorAction SilentlyContinue | Remove-Item -Force
Get-ChildItem release -Filter "GPT2JSON-CoreSetup-v*.exe" -ErrorAction SilentlyContinue | Remove-Item -Force
$version = $env:GPT2JSON_VERSION
if (-not $version) { throw "GPT2JSON_VERSION is not set; Determine release version step did not run." }
$expected = @(
"release/GPT2JSON-Setup-v$version.exe",
"packaging/windows/assets/installer-art-shell-transparent.png"
)
foreach ($path in $expected) {
if (-not (Test-Path -LiteralPath $path)) { throw "Missing required release input: $path" }
}
Compress-Archive -Path dist/GPT2JSON/* -DestinationPath "release/GPT2JSON-v$version-windows-x64.zip" -Force
Get-ChildItem release | Select-Object Name, Length, LastWriteTime
- name: Upload workflow artifact
uses: actions/upload-artifact@v6
with:
name: GPT2JSON-release-assets
path: release/*
- name: Publish GitHub Release
if: startsWith(github.ref, 'refs/tags/')
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$tag = "${{ github.ref_name }}"
gh release view $tag *> $null
if ($LASTEXITCODE -ne 0) {
gh release create $tag --title "GPT2JSON $tag" --generate-notes
}
gh release upload $tag release/* --clobber