Skip to content

fix(linux): resolve assets/ under $PREFIX/share for system-packaged i… #12

fix(linux): resolve assets/ under $PREFIX/share for system-packaged i…

fix(linux): resolve assets/ under $PREFIX/share for system-packaged i… #12

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version sans le "v" (ex: 0.1.0)'
required: true
default: '0.1.0'
jobs:
build_and_release:
name: Build installer and create release
runs-on: windows-latest
env:
PYTHONUTF8: '1'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Resolve version
id: version
shell: pwsh
run: |
if ('${{ github.event_name }}' -eq 'workflow_dispatch') {
$v = '${{ github.event.inputs.version }}'.TrimStart('v')
} else {
$v = '${{ github.ref_name }}'.TrimStart('v')
}
echo "VERSION=$v" >> $env:GITHUB_OUTPUT
- name: Inject version into the package
shell: pwsh
run: |
$v = '${{ steps.version.outputs.VERSION }}'
(Get-Content src/pdf_equilibrist/__init__.py) `
-replace '__version__ = ".*"', "__version__ = ""$v""" |
Set-Content src/pdf_equilibrist/__init__.py
(Get-Content pyproject.toml) `
-replace '^version = ".*"$', "version = ""$v""" |
Set-Content pyproject.toml
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
pip install pyinstaller
- name: Prepare build assets
run: |
python tools/prepare_build.py
- name: Build PyInstaller bundle
run: |
pyinstaller PDF-Equilibrist.spec
- name: Install NSIS (Chocolatey)
run: |
choco install nsis -y
- name: Build NSIS installer
shell: pwsh
run: |
$v = '${{ steps.version.outputs.VERSION }}'
New-Item -ItemType Directory -Path installer\Output -Force
& 'C:\Program Files (x86)\NSIS\makensis.exe' "/DAPP_VERSION=$v" 'installer\PDF-Equilibrist.nsi'
- name: Sign installer (optionnel — nécessite le secret SIGNING_CERT_PFX_B64)
shell: pwsh
env:
CERT_B64: ${{ secrets.SIGNING_CERT_PFX_B64 }}
CERT_PASS: ${{ secrets.SIGNING_CERT_PASSWORD }}
run: |
if (-not $env:CERT_B64) {
Write-Host "Aucun certificat configuré — étape de signature ignorée."
exit 0
}
$bytes = [System.Convert]::FromBase64String($env:CERT_B64)
[IO.File]::WriteAllBytes('signing.pfx', $bytes)
$signtool = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin' -Recurse -Filter 'signtool.exe' -ErrorAction SilentlyContinue | Select-Object -First 1
if (-not $signtool) {
Write-Host "signtool.exe introuvable — signature ignorée."
Remove-Item signing.pfx -Force
exit 0
}
& $signtool.FullName sign /f signing.pfx /p $env:CERT_PASS /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 'installer\Output\PDF-Equilibrist-Setup.exe'
Remove-Item signing.pfx -Force
- name: Create GitHub release and upload asset
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.VERSION }}
name: Release v${{ steps.version.outputs.VERSION }}
generate_release_notes: true
draft: false
prerelease: false
files: installer/Output/PDF-Equilibrist-Setup.exe