Skip to content

Release

Release #18

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Extract version from tag
id: get_version
shell: bash
run: |
TAG="${GITHUB_REF#refs/tags/}"
echo "TAG=$TAG" >> $GITHUB_OUTPUT
echo "NUM=${TAG#v}" >> $GITHUB_OUTPUT
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller pyinstaller-hooks-contrib
- name: Update settings.json with version
shell: bash
env:
TAG: ${{ steps.get_version.outputs.TAG }}
run: |
echo "{\"CURRENT_VERSION\": \"$TAG\"}" > settings.json
- name: Build executable with PyInstaller
run: pyinstaller RFlect.spec
- name: Verify executable exists
shell: bash
run: |
if [ -f "dist/RFlect.exe" ]; then
echo "Executable built successfully"
ls -lh dist/RFlect.exe
else
echo "Executable not found"
ls -la dist/
exit 1
fi
- name: Build Inno Setup installer
uses: Minionguyjpro/Inno-Setup-Action@v1.2.5
with:
path: installer.iss
options: /DRFLECT_VERSION=${{ steps.get_version.outputs.NUM }}
- name: Verify installer exists
shell: bash
run: |
if ls installer_output/RFlect_Installer_*.exe 1>/dev/null 2>&1; then
echo "Installer built successfully"
ls -lh installer_output/
else
echo "WARNING: Installer build failed, continuing with standalone exe only"
fi
- name: Rename standalone exe
shell: bash
env:
TAG: ${{ steps.get_version.outputs.TAG }}
run: cp dist/RFlect.exe "dist/RFlect_${TAG}.exe"
- name: Upload Windows standalone
uses: actions/upload-artifact@v4
with:
name: RFlect-Windows-Standalone
path: dist/RFlect_${{ steps.get_version.outputs.TAG }}.exe
retention-days: 90
- name: Upload Windows installer
uses: actions/upload-artifact@v4
if: ${{ hashFiles('installer_output/RFlect_Installer_*.exe') != '' }}
with:
name: RFlect-Windows-Installer
path: installer_output/RFlect_Installer_*.exe
retention-days: 90
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Extract version from tag
id: get_version
run: |
TAG="${GITHUB_REF#refs/tags/}"
echo "TAG=$TAG" >> $GITHUB_OUTPUT
echo "NUM=${TAG#v}" >> $GITHUB_OUTPUT
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-tk
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller pyinstaller-hooks-contrib
- name: Update settings.json with version
env:
TAG: ${{ steps.get_version.outputs.TAG }}
run: |
echo "{\"CURRENT_VERSION\": \"$TAG\"}" > settings.json
- name: Build executable with PyInstaller
run: pyinstaller RFlect.spec
- name: Verify executable exists
run: |
if [ -f "dist/RFlect" ]; then
echo "Executable built successfully"
ls -lh dist/RFlect
chmod +x dist/RFlect
else
echo "Executable not found"
ls -la dist/
exit 1
fi
- name: Rename linux binary
env:
TAG: ${{ steps.get_version.outputs.TAG }}
run: cp dist/RFlect "dist/RFlect_${TAG}_linux"
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: RFlect-Linux
path: dist/RFlect_${{ steps.get_version.outputs.TAG }}_linux
retention-days: 90
create-release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract version from tag
id: get_version
run: |
TAG="${GITHUB_REF#refs/tags/}"
echo "TAG=$TAG" >> $GITHUB_OUTPUT
echo "NUM=${TAG#v}" >> $GITHUB_OUTPUT
- name: Download Windows standalone
uses: actions/download-artifact@v4
with:
name: RFlect-Windows-Standalone
path: release-assets/
- name: Download Windows installer
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: RFlect-Windows-Installer
path: release-assets/
- name: Download Linux binary
uses: actions/download-artifact@v4
with:
name: RFlect-Linux
path: release-assets/
- name: List release assets
run: ls -lh release-assets/
- name: Extract release notes for this version
env:
NUM: ${{ steps.get_version.outputs.NUM }}
run: |
# Escape dots for awk regex (4.0.0 -> 4\.0\.0)
ESCAPED=$(echo "$NUM" | sed 's/\./\\./g')
# Extract section: from matching header to next ## Version header
awk "/^## Version ${ESCAPED}/{ found=1; print; next } found && /^## Version /{ exit } found{ print }" RELEASE_NOTES.md > release_body.md
if [ ! -s release_body.md ]; then
echo "## Release v${NUM}" > release_body.md
echo "" >> release_body.md
echo "See [RELEASE_NOTES.md](RELEASE_NOTES.md) for full changelog." >> release_body.md
fi
# Append download guidance
TAG="${{ steps.get_version.outputs.TAG }}"
echo "" >> release_body.md
echo "----" >> release_body.md
echo "### Downloads" >> release_body.md
echo "- **Windows (installer)**: \`RFlect_Installer_${NUM}.exe\` — includes Start Menu shortcut and uninstaller" >> release_body.md
echo "- **Windows (portable)**: \`RFlect_${TAG}.exe\` — standalone, no install required" >> release_body.md
echo "- **Linux**: \`RFlect_${TAG}_linux\` — standalone binary (\`chmod +x\` then run)" >> release_body.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: release-assets/*
body_path: release_body.md
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify release complete
env:
TAG: ${{ steps.get_version.outputs.TAG }}
run: |
echo "Release ${TAG} created successfully!"
echo "Download: https://github.com/${{ github.repository }}/releases/tag/${TAG}"