mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-05-27 17:29:59 +02:00
Restore workflows to pre-test state
This commit is contained in:
122
.github/workflows/windows-build.yml
vendored
122
.github/workflows/windows-build.yml
vendored
@@ -1,11 +1,9 @@
|
|||||||
name: Windows Build
|
name: Windows Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
schedule:
|
||||||
branches: [ master ]
|
- cron: '0 2 * * 1' # Every Monday at 2:00 UTC
|
||||||
pull_request:
|
workflow_dispatch: # Manual trigger available at any time
|
||||||
branches: [ master ]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
@@ -181,11 +179,9 @@ jobs:
|
|||||||
done
|
done
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
DLL_SCAN=$(ls -1 "$BIN/"*.dll 2>/dev/null | wc -l)
|
|
||||||
echo "=== $DLL_SCAN DLLs present after scan ==="
|
|
||||||
ls -lh "$BIN/QElectroTech.exe" || { echo "ERROR: exe missing from bin/"; exit 1; }
|
|
||||||
DLL_COUNT=$(find "$BIN" -name "*.dll" | wc -l)
|
DLL_COUNT=$(find "$BIN" -name "*.dll" | wc -l)
|
||||||
echo "DLLs present: $DLL_COUNT"
|
echo "=== $DLL_COUNT DLLs present after scan ==="
|
||||||
|
ls -lh "$BIN/QElectroTech.exe" || { echo "ERROR: exe missing from bin/"; exit 1; }
|
||||||
[ "$DLL_COUNT" -gt 5 ] || { echo "ERROR: too few DLLs"; exit 1; }
|
[ "$DLL_COUNT" -gt 5 ] || { echo "ERROR: too few DLLs"; exit 1; }
|
||||||
cd "$GITHUB_WORKSPACE"
|
cd "$GITHUB_WORKSPACE"
|
||||||
|
|
||||||
@@ -241,15 +237,19 @@ jobs:
|
|||||||
id: qet_version
|
id: qet_version
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
GITCOMMIT=$(git -C "$GITHUB_WORKSPACE" rev-parse --short HEAD)
|
GITCOMMIT=$(git -C "$GITHUB_WORKSPACE" rev-parse --short HEAD)
|
||||||
|
|
||||||
A=$(git -C "$GITHUB_WORKSPACE" rev-list HEAD --count)
|
A=$(git -C "$GITHUB_WORKSPACE" rev-list HEAD --count)
|
||||||
HEAD=$(( A + 473 ))
|
HEAD=$(( A + 473 ))
|
||||||
|
|
||||||
VERSION=$(grep 'return QVersionNumber{' "$GITHUB_WORKSPACE/sources/qetversion.cpp" \
|
VERSION=$(grep 'return QVersionNumber{' "$GITHUB_WORKSPACE/sources/qetversion.cpp" \
|
||||||
| head -1 \
|
| head -1 \
|
||||||
| awk -F '{' '{ print $2 }' \
|
| awk -F '{' '{ print $2 }' \
|
||||||
| awk -F '}' '{ print $1 }' \
|
| awk -F '}' '{ print $1 }' \
|
||||||
| sed -e 's/,/./g' -e 's/ //g')
|
| sed -e 's/,/./g' -e 's/ //g')
|
||||||
[ -z "$VERSION" ] && VERSION="dev"
|
[ -z "$VERSION" ] && VERSION="dev"
|
||||||
|
|
||||||
FULL_VERSION="${VERSION}-r${HEAD}-${GITCOMMIT}_x86_64-win64"
|
FULL_VERSION="${VERSION}-r${HEAD}-${GITCOMMIT}_x86_64-win64"
|
||||||
echo "version=$FULL_VERSION" >> "$GITHUB_OUTPUT"
|
echo "version=$FULL_VERSION" >> "$GITHUB_OUTPUT"
|
||||||
echo "base_version=$VERSION" >> "$GITHUB_OUTPUT"
|
echo "base_version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||||
@@ -268,7 +268,9 @@ jobs:
|
|||||||
NSI="$GITHUB_WORKSPACE/nsis_root/QET64.nsi"
|
NSI="$GITHUB_WORKSPACE/nsis_root/QET64.nsi"
|
||||||
FILES_WIN=$(cygpath -w "$GITHUB_WORKSPACE/nsis_root/files")
|
FILES_WIN=$(cygpath -w "$GITHUB_WORKSPACE/nsis_root/files")
|
||||||
SCRIPT="$GITHUB_WORKSPACE/build-aux/windows/patch_nsi.py"
|
SCRIPT="$GITHUB_WORKSPACE/build-aux/windows/patch_nsi.py"
|
||||||
|
|
||||||
python3 "$SCRIPT" "$NSI" "$VERSION" "$FILES_WIN"
|
python3 "$SCRIPT" "$NSI" "$VERSION" "$FILES_WIN"
|
||||||
|
|
||||||
echo "=== Verification ==="
|
echo "=== Verification ==="
|
||||||
grep 'SOFT_VERSION' "$NSI" | head -1
|
grep 'SOFT_VERSION' "$NSI" | head -1
|
||||||
grep -m2 'nsis_root' "$NSI" | head -2
|
grep -m2 'nsis_root' "$NSI" | head -2
|
||||||
@@ -302,7 +304,6 @@ jobs:
|
|||||||
echo "Moving: $INSTALLER -> dist/"
|
echo "Moving: $INSTALLER -> dist/"
|
||||||
mv "$INSTALLER" "$GITHUB_WORKSPACE/dist/"
|
mv "$INSTALLER" "$GITHUB_WORKSPACE/dist/"
|
||||||
|
|
||||||
|
|
||||||
- name: Upload build logs on failure
|
- name: Upload build logs on failure
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -313,11 +314,30 @@ jobs:
|
|||||||
nsis_root/files/bin/
|
nsis_root/files/bin/
|
||||||
if-no-files-found: warn
|
if-no-files-found: warn
|
||||||
|
|
||||||
|
- name: Zip portable (readytouse)
|
||||||
|
id: zip_portable
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$version = "${{ steps.qet_version.outputs.base_version }}"
|
||||||
|
$head = "${{ steps.qet_version.outputs.head }}"
|
||||||
|
$zipName = "qelectrotech-${version}+git${head}-x86-win64-readytouse.zip"
|
||||||
|
$src = "$env:GITHUB_WORKSPACE\nsis_root\files"
|
||||||
|
$dst = "$env:GITHUB_WORKSPACE\dist\$zipName"
|
||||||
|
$7z = "C:\Program Files\7-Zip\7z.exe"
|
||||||
|
|
||||||
|
New-Item -ItemType Directory -Force -Path "$env:GITHUB_WORKSPACE\dist" | Out-Null
|
||||||
|
& $7z a -tzip -mx=5 -mmt=on $dst "$src\*"
|
||||||
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||||
|
|
||||||
|
$sizeMB = [math]::Round((Get-Item $dst).Length / 1MB, 1)
|
||||||
|
Write-Output "ZIP created: $zipName ($sizeMB MB)"
|
||||||
|
"zip_name=$zipName" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||||
|
|
||||||
- name: Upload portable (files/ without installer)
|
- name: Upload portable (files/ without installer)
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: qelectrotech-${{ steps.qet_version.outputs.base_version }}+git${{ steps.qet_version.outputs.head }}-x86-win64-readytouse
|
name: qelectrotech-${{ steps.qet_version.outputs.base_version }}+git${{ steps.qet_version.outputs.head }}-x86-win64-readytouse
|
||||||
path: nsis_root/files/
|
path: dist/${{ steps.zip_portable.outputs.zip_name }}
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
|
||||||
- name: Upload NSIS installer
|
- name: Upload NSIS installer
|
||||||
@@ -326,3 +346,83 @@ jobs:
|
|||||||
name: qelectrotech-windows-installer
|
name: qelectrotech-windows-installer
|
||||||
path: dist/Installer_*.exe
|
path: dist/Installer_*.exe
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
|
||||||
|
- name: Upload portable (nom fixe pour le workflow MSI)
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: qelectrotech-windows-portable
|
||||||
|
path: nsis_root/files/
|
||||||
|
retention-days: 14
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# Job 2 : Publie une release nightly + page GitHub Pages
|
||||||
|
# Ne tourne que sur push master (pas sur les PRs)
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
deploy-pages:
|
||||||
|
needs: build-windows
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout master (for build-aux scripts)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: master
|
||||||
|
path: source
|
||||||
|
sparse-checkout: build-aux/generate-page.py
|
||||||
|
sparse-checkout-cone-mode: false
|
||||||
|
|
||||||
|
- name: Download installer artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: qelectrotech-windows-installer
|
||||||
|
path: downloaded/installer/
|
||||||
|
|
||||||
|
- name: Download portable artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
pattern: qelectrotech-*-readytouse
|
||||||
|
path: downloaded/portable/
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Delete old nightly assets (.exe and .zip)
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
run: |
|
||||||
|
# Fetch existing .exe and .zip asset names and delete them
|
||||||
|
gh release view nightly --repo "$REPO" --json assets \
|
||||||
|
--jq '.assets[] | select(.name | test("\\.(exe|zip)$")) | .name' \
|
||||||
|
| while read -r name; do
|
||||||
|
echo "Deleting old asset: $name"
|
||||||
|
gh release delete-asset nightly "$name" --repo "$REPO" --yes
|
||||||
|
done
|
||||||
|
echo "Old .exe and .zip assets deleted."
|
||||||
|
|
||||||
|
- name: Update nightly release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: nightly
|
||||||
|
name: "Nightly Build – Windows"
|
||||||
|
body: |
|
||||||
|
🔧 **Automated nightly build** — may be unstable.
|
||||||
|
|
||||||
|
| | |
|
||||||
|
|---|---|
|
||||||
|
| **Commit** | ${{ github.sha }} |
|
||||||
|
| **Run** | https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |
|
||||||
|
| **Date** | ${{ github.event.head_commit.timestamp }} |
|
||||||
|
|
||||||
|
> ⚠️ This is a development version; it introduces new features you want, but may cause bugs that have not yet been identified yet.
|
||||||
|
> For stable releases, see the [Releases page](https://github.com/${{ github.repository }}/releases).
|
||||||
|
prerelease: true
|
||||||
|
make_latest: false
|
||||||
|
files: |
|
||||||
|
downloaded/installer/*.exe
|
||||||
|
downloaded/portable/*.zip
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# GitHub Pages is generated and deployed by windows-msi.yml
|
||||||
|
# after the MSI upload, so that all 3 URLs (exe, zip, msi) are known.
|
||||||
|
|||||||
159
.github/workflows/windows-msi.yml
vendored
159
.github/workflows/windows-msi.yml
vendored
@@ -1,10 +1,16 @@
|
|||||||
name: Windows MSI (WiX v7)
|
name: Windows MSI (WiX v7)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
# Triggered automatically after a successful Windows build on master
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Windows Build"]
|
||||||
|
types: [completed]
|
||||||
|
branches: [master]
|
||||||
|
# Manual trigger still available (e.g. for a specific run_id)
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
run_id:
|
run_id:
|
||||||
description: "Run ID of 'Windows Build' (leave empty for the latest successful run)"
|
description: "Run ID of 'Windows Build' (leave empty for automatic)"
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
|
|
||||||
@@ -13,7 +19,18 @@ jobs:
|
|||||||
name: Build MSI with WiX v7
|
name: Build MSI with WiX v7
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
# Only runs if Windows Build succeeded (or triggered manually)
|
||||||
|
if: >
|
||||||
|
github.event_name == 'workflow_dispatch' ||
|
||||||
|
github.event.workflow_run.conclusion == 'success'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# 1. Checkout (to retrieve QElectroTech.wxs and sources)
|
# 1. Checkout (to retrieve QElectroTech.wxs and sources)
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
@@ -30,7 +47,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: qelectrotech-windows-portable
|
name: qelectrotech-windows-portable
|
||||||
path: artifact\files
|
path: artifact\files
|
||||||
run-id: ${{ github.event.inputs.run_id || github.run_id }}
|
run-id: ${{ github.event.workflow_run.id || github.event.inputs.run_id || github.run_id }}
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
repository: ${{ github.repository }}
|
repository: ${{ github.repository }}
|
||||||
|
|
||||||
@@ -52,14 +69,12 @@ jobs:
|
|||||||
$ver = "0.0.0"
|
$ver = "0.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$verMsi = "$ver.0"
|
$verMsi = "$ver.0"
|
||||||
$sha = git rev-parse --short HEAD 2>$null
|
$sha = git rev-parse --short HEAD 2>$null
|
||||||
if (-not $sha) { $sha = "unknown" }
|
if (-not $sha) { $sha = "unknown" }
|
||||||
$count = git rev-list HEAD --count 2>$null
|
$count = git rev-list HEAD --count 2>$null
|
||||||
$rev = [int]$count + 473
|
$rev = [int]$count + 473
|
||||||
$verDisplay = "${ver}-r${rev}-${sha}_x86_64-win64"
|
$verDisplay = "${ver}-r${rev}-${sha}_x86_64-win64"
|
||||||
|
|
||||||
echo "VERSION_MSI=$verMsi" >> $env:GITHUB_OUTPUT
|
echo "VERSION_MSI=$verMsi" >> $env:GITHUB_OUTPUT
|
||||||
echo "VERSION_DISPLAY=$verDisplay" >> $env:GITHUB_OUTPUT
|
echo "VERSION_DISPLAY=$verDisplay" >> $env:GITHUB_OUTPUT
|
||||||
Write-Host "Version MSI : $verMsi"
|
Write-Host "Version MSI : $verMsi"
|
||||||
@@ -77,6 +92,7 @@ jobs:
|
|||||||
echo $toolsPath >> $env:GITHUB_PATH
|
echo $toolsPath >> $env:GITHUB_PATH
|
||||||
wix eula accept wix7
|
wix eula accept wix7
|
||||||
wix extension add WixToolset.UI.wixext/7.0.0
|
wix extension add WixToolset.UI.wixext/7.0.0
|
||||||
|
wix extension add WixToolset.Util.wixext/7.0.0
|
||||||
Write-Host "WiX v7 installed, EULA accepted, UI extension added."
|
Write-Host "WiX v7 installed, EULA accepted, UI extension added."
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
@@ -88,7 +104,6 @@ jobs:
|
|||||||
$wxs = "build-aux\windows\QElectroTech.wxs"
|
$wxs = "build-aux\windows\QElectroTech.wxs"
|
||||||
if (-not (Test-Path $wxs)) {
|
if (-not (Test-Path $wxs)) {
|
||||||
Write-Error "WXS file not found: $wxs"
|
Write-Error "WXS file not found: $wxs"
|
||||||
Get-ChildItem "build-aux\windows\" -ErrorAction SilentlyContinue
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
Write-Host "WXS found: $wxs"
|
Write-Host "WXS found: $wxs"
|
||||||
@@ -104,39 +119,37 @@ jobs:
|
|||||||
Select-Object FullName | Format-Table -AutoSize
|
Select-Object FullName | Format-Table -AutoSize
|
||||||
|
|
||||||
$exe = Get-ChildItem -Path "artifact\files" -Filter "qelectrotech.exe" -Recurse | Select-Object -First 1
|
$exe = Get-ChildItem -Path "artifact\files" -Filter "qelectrotech.exe" -Recurse | Select-Object -First 1
|
||||||
|
if (-not $exe) {
|
||||||
|
$exe = Get-ChildItem -Path "artifact\files" -Filter "QElectroTech.exe" -Recurse | Select-Object -First 1
|
||||||
|
}
|
||||||
if (-not $exe) {
|
if (-not $exe) {
|
||||||
Write-Error "qelectrotech.exe not found in artifact"
|
Write-Error "qelectrotech.exe not found in artifact"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
Write-Host "Executable: $($exe.FullName) ($([math]::Round($exe.Length/1MB,1)) MB)"
|
Write-Host "Executable: $($exe.FullName) ($([math]::Round($exe.Length/1MB,1)) MB)"
|
||||||
|
|
||||||
$binDir = $exe.Directory.FullName
|
$binDir = $exe.Directory.FullName
|
||||||
$filesDir = Split-Path $binDir -Parent
|
$filesDir = Split-Path $binDir -Parent
|
||||||
|
|
||||||
echo "FILES_DIR=$filesDir" >> $env:GITHUB_ENV
|
echo "FILES_DIR=$filesDir" >> $env:GITHUB_ENV
|
||||||
Write-Host "FILES_DIR: $filesDir"
|
Write-Host "FILES_DIR: $filesDir"
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# 7. Convert LICENSE to RTF for the WixUI licence screen
|
# 7. Convert LICENSE (GPL-2) to RTF for the WixUI licence screen
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
- name: Convert LICENSE to RTF
|
- name: Convert LICENSE to RTF
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$licSrc = "LICENSE"
|
$licSrc = "LICENSE"
|
||||||
$licRtf = "$env:TEMP\License.rtf"
|
$licRtf = "$env:TEMP\License.rtf"
|
||||||
|
|
||||||
if (-not (Test-Path $licSrc)) {
|
if (-not (Test-Path $licSrc)) {
|
||||||
Write-Error "LICENSE file not found in repository root"
|
Write-Error "LICENSE file not found in repository root"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$lines = Get-Content $licSrc -Encoding UTF8
|
$lines = Get-Content $licSrc -Encoding UTF8
|
||||||
$rtf = New-Object System.Text.StringBuilder
|
$rtf = New-Object System.Text.StringBuilder
|
||||||
[void]$rtf.AppendLine('{\rtf1\ansi\ansicpg1252\deff0')
|
[void]$rtf.AppendLine('{\rtf1\ansi\ansicpg1252\deff0')
|
||||||
[void]$rtf.AppendLine('{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}}')
|
[void]$rtf.AppendLine('{\fonttbl{\f0\fmodern\fprq1\fcharset0 Courier New;}}')
|
||||||
[void]$rtf.AppendLine('{\colortbl;\red0\green0\blue0;}')
|
[void]$rtf.AppendLine('{\colortbl;\red0\green0\blue0;}')
|
||||||
[void]$rtf.AppendLine('\f0\fs18\cf1')
|
[void]$rtf.AppendLine('\f0\fs18\cf1')
|
||||||
|
|
||||||
foreach ($line in $lines) {
|
foreach ($line in $lines) {
|
||||||
$escaped = $line `
|
$escaped = $line `
|
||||||
-replace '\\', '\\\\' `
|
-replace '\\', '\\\\' `
|
||||||
@@ -144,23 +157,28 @@ jobs:
|
|||||||
-replace '\}', '\}'
|
-replace '\}', '\}'
|
||||||
[void]$rtf.AppendLine("$escaped\par")
|
[void]$rtf.AppendLine("$escaped\par")
|
||||||
}
|
}
|
||||||
|
|
||||||
[void]$rtf.AppendLine('}')
|
[void]$rtf.AppendLine('}')
|
||||||
[System.IO.File]::WriteAllText($licRtf, $rtf.ToString(), [System.Text.Encoding]::ASCII)
|
[System.IO.File]::WriteAllText($licRtf, $rtf.ToString(), [System.Text.Encoding]::ASCII)
|
||||||
echo "LICENSE_RTF=$licRtf" >> $env:GITHUB_ENV
|
echo "LICENSE_RTF=$licRtf" >> $env:GITHUB_ENV
|
||||||
Write-Host "License.rtf generated: $licRtf ($([math]::Round((Get-Item $licRtf).Length/1KB,1)) KB)"
|
Write-Host "License.rtf generated: $licRtf ($([math]::Round((Get-Item $licRtf).Length/1KB,1)) KB)"
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# 8. Replace Lancer QET.bat with the MSI-specific version
|
# 8. Remove Lancer QET.bat from the artifact
|
||||||
|
# The MSI does not use the .bat: shortcuts point directly to
|
||||||
|
# qelectrotech.exe, and elements\ is set read-only via a
|
||||||
|
# CustomAction in QElectroTech.wxs.
|
||||||
|
# The .bat is kept as-is in the ZIP portable build.
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
- name: Replace Lancer QET.bat for MSI
|
- name: Remove Lancer QET.bat from artifact
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$bat = "$env:FILES_DIR\Lancer QET.bat"
|
$bat = "$env:FILES_DIR\Lancer QET.bat"
|
||||||
$content = "@echo off`r`nstart `"`" `"%~dp0bin\qelectrotech.exe`" --common-elements-dir=`"%~dp0elements/`" --common-tbt-dir=`"%~dp0titleblocks/`" --lang-dir=`"%~dp0lang/`" -style windowsvista`r`n"
|
if (Test-Path $bat) {
|
||||||
[System.IO.File]::WriteAllText($bat, $content, [System.Text.Encoding]::ASCII)
|
Remove-Item $bat -Force
|
||||||
Write-Host "Lancer QET.bat replaced for MSI installation."
|
Write-Host "Lancer QET.bat removed from artifact (MSI uses direct exe shortcut)."
|
||||||
Get-Content $bat
|
} else {
|
||||||
|
Write-Host "Lancer QET.bat not found in artifact (already absent)."
|
||||||
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# 9. Build the MSI
|
# 9. Build the MSI
|
||||||
@@ -191,46 +209,19 @@ jobs:
|
|||||||
-d "FilesDir=$filesDir" `
|
-d "FilesDir=$filesDir" `
|
||||||
-d "LicenseRtf=$licRtf" `
|
-d "LicenseRtf=$licRtf" `
|
||||||
-ext WixToolset.UI.wixext `
|
-ext WixToolset.UI.wixext `
|
||||||
|
-ext WixToolset.Util.wixext `
|
||||||
-o "dist\$outputName"
|
-o "dist\$outputName"
|
||||||
|
|
||||||
if (-not (Test-Path "dist\$outputName")) {
|
if (-not (Test-Path "dist\$outputName")) {
|
||||||
Write-Error "MSI not generated: dist\$outputName"
|
Write-Error "MSI not generated: dist\$outputName"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$size = [math]::Round((Get-Item "dist\$outputName").Length / 1MB, 1)
|
$size = [math]::Round((Get-Item "dist\$outputName").Length / 1MB, 1)
|
||||||
Write-Host "MSI generated: dist\$outputName ($size MB) ✓"
|
Write-Host "MSI generated: dist\$outputName ($size MB) ✓"
|
||||||
echo "MSI_NAME=$outputName" >> $env:GITHUB_ENV
|
echo "MSI_NAME=$outputName" >> $env:GITHUB_ENV
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# 10. Sign the MSI with SignPath
|
# 10. Upload the MSI artifact
|
||||||
# ----------------------------------------------------------------
|
|
||||||
- name: Install SignPath PowerShell module
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
Install-Module -Name SignPath -Force -Scope CurrentUser
|
|
||||||
|
|
||||||
- name: Sign MSI with SignPath
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
$msi = Get-ChildItem "$env:GITHUB_WORKSPACE\dist\*.msi" | Select-Object -First 1
|
|
||||||
if (-not $msi) {
|
|
||||||
Write-Error "No .msi found in dist/"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
Write-Host "Signing: $($msi.FullName)"
|
|
||||||
Submit-SigningRequest `
|
|
||||||
-InputArtifactPath $msi.FullName `
|
|
||||||
-ApiToken "${{ secrets.SIGNPATH_API_TOKEN }}" `
|
|
||||||
-OrganizationId "${{ secrets.SIGNPATH_ORGANIZATION_ID }}" `
|
|
||||||
-ProjectSlug "MSI" `
|
|
||||||
-SigningPolicySlug "test-signing" `
|
|
||||||
-OutputArtifactPath $msi.FullName `
|
|
||||||
-WaitForCompletion
|
|
||||||
Write-Host "Signing complete: $($msi.Name)"
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
|
||||||
# 11. Upload the MSI artifact
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
- name: Upload MSI artifact
|
- name: Upload MSI artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -240,6 +231,32 @@ jobs:
|
|||||||
retention-days: 14
|
retention-days: 14
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
# 11. Delete old .msi asset then upload new MSI to nightly release
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
- name: Delete old nightly .msi asset
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
run: |
|
||||||
|
gh release view nightly --repo "$REPO" --json assets \
|
||||||
|
--jq '.assets[] | select(.name | test("\\.msi$")) | .name' \
|
||||||
|
| while read -r name; do
|
||||||
|
echo "Deleting old asset: $name"
|
||||||
|
gh release delete-asset nightly "$name" --repo "$REPO" --yes
|
||||||
|
done
|
||||||
|
echo "Old .msi assets deleted."
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Upload MSI to nightly release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: nightly
|
||||||
|
files: dist/*.msi
|
||||||
|
fail_on_unmatched_files: true
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# 12. Summary
|
# 12. Summary
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
@@ -257,3 +274,51 @@ jobs:
|
|||||||
} else {
|
} else {
|
||||||
Write-Host "MSI : FAILED ✗"
|
Write-Host "MSI : FAILED ✗"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
# 13. Generate and deploy the GitHub Pages download page
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
- name: Checkout (for generate-page.py)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: master
|
||||||
|
path: source
|
||||||
|
sparse-checkout: build-aux/generate-page.py
|
||||||
|
sparse-checkout-cone-mode: false
|
||||||
|
|
||||||
|
- name: Generate download page (index.html)
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
REPO="${{ github.repository }}"
|
||||||
|
ASSETS=$(gh release view nightly --repo "$REPO" --json assets --jq '.assets[].name')
|
||||||
|
EXE_NAME=$(echo "$ASSETS" | grep '\.exe$' | head -1)
|
||||||
|
ZIP_NAME=$(echo "$ASSETS" | grep '\.zip$' | head -1)
|
||||||
|
MSI_NAME=$(echo "$ASSETS" | grep '\.msi$' | head -1 || echo "")
|
||||||
|
BASE="https://github.com/$REPO/releases/download/nightly"
|
||||||
|
INSTALLER_URL="$BASE/$EXE_NAME"
|
||||||
|
PORTABLE_URL="$BASE/$ZIP_NAME"
|
||||||
|
MSI_URL=""
|
||||||
|
[ -n "$MSI_NAME" ] && MSI_URL="$BASE/$MSI_NAME"
|
||||||
|
SHA="${{ github.event.workflow_run.head_sha || github.sha }}"
|
||||||
|
SHORT="${SHA:0:7}"
|
||||||
|
DATE=$(date -u '+%Y-%m-%d %H:%M UTC')
|
||||||
|
RUN_URL="https://github.com/$REPO/actions/runs/${{ github.run_id }}"
|
||||||
|
RUN_NUMBER="${{ github.run_number }}"
|
||||||
|
export DATE SHORT REPO SHA RUN_URL RUN_NUMBER
|
||||||
|
export INSTALLER_URL PORTABLE_URL MSI_URL
|
||||||
|
python3 source/build-aux/generate-page.py
|
||||||
|
|
||||||
|
- name: Add .nojekyll
|
||||||
|
shell: bash
|
||||||
|
run: touch gh-pages/.nojekyll
|
||||||
|
|
||||||
|
- name: Upload GitHub Pages artifact
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
with:
|
||||||
|
path: gh-pages/
|
||||||
|
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
|
|||||||
Reference in New Issue
Block a user