Skip to content

feat(ci): add version tagging to build artifacts and improve installer #51

feat(ci): add version tagging to build artifacts and improve installer

feat(ci): add version tagging to build artifacts and improve installer #51

Workflow file for this run

name: Build Release Multi-platform
on:
push:
branches:
- '**'
release:
types: [created]
jobs:
build:
strategy:
matrix:
include:
# --- Linux ---
- os: ubuntu-24.04
arch: x86_64
asset_suffix: linux-x86_64
- os: ubuntu-24.04-arm
arch: arm64
asset_suffix: linux-arm64
# --- MacOS ---
- os: macos-14 # arm64 runner
arch: arm64
asset_suffix: macos-arm64
- os: macos-13 # x86_64 runner
arch: x86_64
asset_suffix: macos-x86_64
# --- Windows ---
- os: windows-latest
arch: x86_64
asset_suffix: windows-x86_64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Determine version
id: meta
shell: bash
run: |
if [ "${{ github.event_name }}" = "release" ]; then
echo "version=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
else
echo "version=dev" >> "$GITHUB_OUTPUT"
fi
# ==== Linux (native runners, no Docker) ====
- name: Build on Linux (native)
if: startsWith(matrix.os, 'ubuntu')
run: |
pip install -r requirements.txt
pip install pyinstaller
chmod +x build.sh
./build.sh "${{ steps.meta.outputs.version }}"
mv dist/tricode dist/tricode-${{ matrix.asset_suffix }}-${{ steps.meta.outputs.version }}
# ==== MacOS ====
- name: Build on macOS
if: startsWith(matrix.os, 'macos')
run: |
pip install -r requirements.txt
pip install pyinstaller
chmod +x build.sh
./build.sh "${{ steps.meta.outputs.version }}"
mv dist/tricode dist/tricode-${{ matrix.asset_suffix }}-${{ steps.meta.outputs.version }}
# ==== Windows ====
- name: Build on Windows
if: startsWith(matrix.os, 'windows')
shell: cmd
run: |
pip install -r requirements.txt
pip install pyinstaller
.\build.bat ${{ steps.meta.outputs.version }}
- name: Rename Windows artifact
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
$src = "dist/tricode.exe"
$dst = "dist/tricode-${{ matrix.asset_suffix }}-${{ steps.meta.outputs.version }}.exe"
if (!(Test-Path $src)) { Write-Error "Source not found: $src"; exit 1 }
if (Test-Path $dst) { Remove-Item $dst -Force }
try {
Move-Item -LiteralPath $src -Destination $dst -Force -ErrorAction Stop
} catch {
Copy-Item -LiteralPath $src -Destination $dst -Force
Remove-Item -LiteralPath $src -Force
}
- name: Upload artifact (Windows)
if: startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v4
with:
name: tricode-${{ matrix.asset_suffix }}-${{ steps.meta.outputs.version }}
path: |
dist/tricode-${{ matrix.asset_suffix }}-${{ steps.meta.outputs.version }}.exe
- name: Upload artifact (Unix)
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v4
with:
name: tricode-${{ matrix.asset_suffix }}-${{ steps.meta.outputs.version }}
path: |
dist/tricode-${{ matrix.asset_suffix }}-${{ steps.meta.outputs.version }}
- name: Upload to release (Windows)
if: github.event_name == 'release' && startsWith(matrix.os, 'windows')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} dist/tricode-${{ matrix.asset_suffix }}-${{ steps.meta.outputs.version }}.exe --clobber
- name: Upload to release (Unix)
if: github.event_name == 'release' && (startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos'))
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} dist/tricode-${{ matrix.asset_suffix }}-${{ steps.meta.outputs.version }} --clobber