Skip to content

Release

Release #3

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
build-and-release:
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Extract version from tag
id: version
run: |
$tag = "${{ github.ref_name }}"
$version = $tag -replace '^v', ''
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
echo "Extracted version: $version"
- name: Update version.py
run: |
$version = "${{ steps.version.outputs.VERSION }}"
$file = "alpha/version.py"
$content = Get-Content $file -Raw
$content = $content -replace '__version__ = "[^"]*"', "__version__ = `"$version`""
Set-Content $file $content
Write-Host "Updated version.py to $version"
- name: Update installer.iss version
run: |
$version = "${{ steps.version.outputs.VERSION }}"
$file = "installer.iss"
$content = Get-Content $file -Raw
$content = $content -replace '#define MyAppVersion "[^"]*"', "#define MyAppVersion `"$version`""
Set-Content $file $content
Write-Host "Updated installer.iss to $version"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller pytest pytest-qt
- name: Build executable
run: pyinstaller alpha.spec
- name: Install Inno Setup
run: |
choco install innosetup -y
- name: Build installer
run: |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer.iss
- name: Rename installer with version
run: |
$version = "${{ steps.version.outputs.VERSION }}"
if (Test-Path "dist\ALPHA_Installer_v$version.exe") {
Write-Host "Installer already named correctly."
} else {
# Inno Setup output name is configured as OutputBaseFilename=ALPHA_Installer_v{#MyAppVersion}
# So if we updated the ISS correctly, it should be correct.
# But let's verify or rename if Inno generates a fixed name.
# My ISS uses OutputBaseFilename=ALPHA_Installer_v{#MyAppVersion}
# So it should be fine. User's script did a rename.
# I'll stick to listing files in GH Release to be safe.
}
# For consistency with User Request, let's just ensure we capture the file.
- name: Generate release notes
id: notes
run: |
$notes = @"
## ALPHA Init Tool v${{ steps.version.outputs.VERSION }}
### Downloads
- **Windows Installer**: ALPHA_Installer_v${{ steps.version.outputs.VERSION }}.exe
### Features
- Stack Initialization (Django, FastAPI, Next.js, etc.)
- Docker Support
- Auto-Updates
"@
echo "NOTES<<EOF" >> $env:GITHUB_OUTPUT
echo $notes >> $env:GITHUB_OUTPUT
echo "EOF" >> $env:GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: ALPHA v${{ steps.version.outputs.VERSION }}
body: ${{ steps.notes.outputs.NOTES }}
draft: false
prerelease: false
files: dist/ALPHA_Installer_v${{ steps.version.outputs.VERSION }}.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}