Refactor Windows workflow for GitHub Actions

Updated GitHub Actions workflow for Windows build. Added permissions for GITHUB_TOKEN and modified steps for artifact uploads and releases.
This commit is contained in:
jpcozar
2026-08-29 12:15:28 +02:00
committed by GitHub
parent 3c32ce308a
commit 878068b733
+52 -30
View File
@@ -5,6 +5,10 @@ on:
branches: [ master ]
workflow_dispatch:
# Necesario para que GITHUB_TOKEN pueda crear la Release.
permissions:
contents: write
env:
QT_VERSION: '6.8.3'
QT_ARCH: 'win64_msvc2022_64'
@@ -44,17 +48,13 @@ jobs:
uses: jurplel/install-qt-action@v4
with:
version: ${{ env.QT_VERSION }}
host: 'windows'
target: 'desktop'
host: windows
target: desktop
arch: ${{ env.QT_ARCH }}
modules: 'qtserialport qt5compat'
cache: true
# ── 3. Cache built dependencies ───────────────────────────────────────
#
# v3 => obliga a reconstruir libgit2 como DLL y evita reutilizar
# la antigua caché donde libgit2 estaba compilada estáticamente.
#
- name: Cache dependencies
id: deps-cache
uses: actions/cache@v4
@@ -94,11 +94,7 @@ jobs:
copy zconf.h ..
shell: cmd
# ── 5. Build libgit2 AS DLL ───────────────────────────────────────────
#
# Fritzing compila usando símbolos __imp_git_*.
# Eso significa que espera una import library + DLL, no libgit2 estática.
#
# ── 5. Build libgit2 as DLL ───────────────────────────────────────────
- name: Clone libgit2
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
@@ -134,8 +130,6 @@ jobs:
- name: Verify libgit2 build
if: steps.deps-cache.outputs.cache-hit != 'true'
run: |
Write-Host "=== Looking for libgit2 outputs ==="
$GitLib = Get-ChildItem "libgit2\build64" `
-Recurse `
-Filter "git2.lib" |
@@ -336,6 +330,7 @@ jobs:
Write-Host "=== Directory Structure ==="
Write-Host "--- libgit2 ---"
Get-ChildItem `
"libgit2\include\git2.h" `
-ErrorAction SilentlyContinue
@@ -398,11 +393,6 @@ jobs:
}
shell: pwsh
# Fritzing's current qmake project searches this versioned sibling
# directory. We stage the REAL dynamic libgit2 here:
# include/ -> headers
# lib/git2.lib -> DLL import library
# lib/git2.dll -> runtime DLL
- name: Setup libgit2 compatibility directory
run: |
$CompatDir = "libgit2-${{ env.LIBGIT2_VERSION }}"
@@ -458,6 +448,7 @@ jobs:
"$CompatDir\lib\git2.dll"
Write-Host "libgit2 compatibility layout:"
Get-ChildItem `
$CompatDir `
-Recurse |
@@ -529,8 +520,8 @@ jobs:
-Force
shell: pwsh
# ── 13. Extract Version & Compress ────────────────────────────────────
- name: Extract Fritzing Version & Zip
# ── 13. Extract Fritzing version ──────────────────────────────────────
- name: Extract Fritzing Version
run: |
$verFile = "fritzing-app\src\version\version.cpp"
@@ -558,16 +549,22 @@ jobs:
echo "FRITZING_VER=$versionStr" >> $env:GITHUB_ENV
$zipName = "Fritzing-$versionStr-Windows-x64.zip"
Write-Host "Fritzing version: $versionStr"
shell: pwsh
# ── 14. Create base ZIP ────────────────────────────────────────────────
- name: Create base Windows ZIP
run: |
$zipName = "Fritzing-$env:FRITZING_VER-Windows-x64.zip"
Compress-Archive `
-Path "release64\*" `
-DestinationPath $zipName
echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV
echo "BASE_ZIP_FILE=$zipName" >> $env:GITHUB_ENV
shell: pwsh
# ── 14. Compile Online Installer ──────────────────────────────────────
# ── 15. Prepare Online Installer ──────────────────────────────────────
- name: Zip fritzing-parts for Online Installer
run: |
git clone `
@@ -595,7 +592,7 @@ jobs:
-Force
shell: pwsh
- name: Compile Online Setup (Downloads parts)
- name: Compile Online Setup
run: |
Copy-Item `
"fritzing-build\fritzing_setup.iss" `
@@ -616,7 +613,7 @@ jobs:
>> $env:GITHUB_ENV
shell: pwsh
# ── 15. Bundle fritzing-parts for Offline usage ───────────────────────
# ── 16. Bundle fritzing-parts for Offline/Portable ────────────────────
- name: Clone fritzing-parts into release64
run: |
git clone \
@@ -630,7 +627,7 @@ jobs:
https://github.com/fritzing/fritzing-parts.git
shell: bash
# ── 16. Compile Portable ZIP ──────────────────────────────────────────
# ── 17. Create Portable ZIP ────────────────────────────────────────────
- name: Compress Portable ZIP
run: |
$zipName = `
@@ -648,8 +645,8 @@ jobs:
echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV
shell: pwsh
# ── 17. Compile Offline Installer ─────────────────────────────────────
- name: Compile Offline Setup (Bundled parts)
# ── 18. Compile Offline Installer ─────────────────────────────────────
- name: Compile Offline Setup
run: |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" `
/dMyAppVersion="$env:FRITZING_VER" `
@@ -661,7 +658,31 @@ jobs:
>> $env:GITHUB_ENV
shell: pwsh
# ── 18. Create GitHub Release ─────────────────────────────────────────
# ── 19. Upload Artifacts ───────────────────────────────────────────────
#
# MUY IMPORTANTE:
# aunque el paso posterior de GitHub Release falle, estos ficheros
# quedarán disponibles en Actions -> Summary -> Artifacts.
#
- name: Upload Fritzing build artifacts
uses: actions/upload-artifact@v4
with:
name: Fritzing-${{ env.FRITZING_VER }}-Windows-x64
path: |
${{ env.BASE_ZIP_FILE }}
${{ env.ZIP_FILE }}
${{ env.ONLINE_SETUP_FILE }}
${{ env.OFFLINE_SETUP_FILE }}
fritzing-parts.zip
if-no-files-found: error
compression-level: 0
retention-days: 30
# ── 20. Create GitHub Release ─────────────────────────────────────────
#
# Usa el token automático de GitHub.
# No hace falta crear CUSTOM_GITHUB_TOKEN.
#
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: github.ref == 'refs/heads/master'
@@ -669,9 +690,10 @@ jobs:
tag_name: ${{ env.FRITZING_VER }}
name: "Fritzing ${{ env.FRITZING_VER }}"
files: |
${{ env.BASE_ZIP_FILE }}
${{ env.ZIP_FILE }}
${{ env.ONLINE_SETUP_FILE }}
${{ env.OFFLINE_SETUP_FILE }}
fritzing-parts.zip
draft: true
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}