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 ] branches: [ master ]
workflow_dispatch: workflow_dispatch:
# Necesario para que GITHUB_TOKEN pueda crear la Release.
permissions:
contents: write
env: env:
QT_VERSION: '6.8.3' QT_VERSION: '6.8.3'
QT_ARCH: 'win64_msvc2022_64' QT_ARCH: 'win64_msvc2022_64'
@@ -44,17 +48,13 @@ jobs:
uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
with: with:
version: ${{ env.QT_VERSION }} version: ${{ env.QT_VERSION }}
host: 'windows' host: windows
target: 'desktop' target: desktop
arch: ${{ env.QT_ARCH }} arch: ${{ env.QT_ARCH }}
modules: 'qtserialport qt5compat' modules: 'qtserialport qt5compat'
cache: true cache: true
# ── 3. Cache built dependencies ─────────────────────────────────────── # ── 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 - name: Cache dependencies
id: deps-cache id: deps-cache
uses: actions/cache@v4 uses: actions/cache@v4
@@ -94,11 +94,7 @@ jobs:
copy zconf.h .. copy zconf.h ..
shell: cmd shell: cmd
# ── 5. Build libgit2 AS DLL ─────────────────────────────────────────── # ── 5. Build libgit2 as DLL ───────────────────────────────────────────
#
# Fritzing compila usando símbolos __imp_git_*.
# Eso significa que espera una import library + DLL, no libgit2 estática.
#
- name: Clone libgit2 - name: Clone libgit2
if: steps.deps-cache.outputs.cache-hit != 'true' if: steps.deps-cache.outputs.cache-hit != 'true'
run: | run: |
@@ -134,8 +130,6 @@ jobs:
- name: Verify libgit2 build - name: Verify libgit2 build
if: steps.deps-cache.outputs.cache-hit != 'true' if: steps.deps-cache.outputs.cache-hit != 'true'
run: | run: |
Write-Host "=== Looking for libgit2 outputs ==="
$GitLib = Get-ChildItem "libgit2\build64" ` $GitLib = Get-ChildItem "libgit2\build64" `
-Recurse ` -Recurse `
-Filter "git2.lib" | -Filter "git2.lib" |
@@ -336,6 +330,7 @@ jobs:
Write-Host "=== Directory Structure ===" Write-Host "=== Directory Structure ==="
Write-Host "--- libgit2 ---" Write-Host "--- libgit2 ---"
Get-ChildItem ` Get-ChildItem `
"libgit2\include\git2.h" ` "libgit2\include\git2.h" `
-ErrorAction SilentlyContinue -ErrorAction SilentlyContinue
@@ -398,11 +393,6 @@ jobs:
} }
shell: pwsh 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 - name: Setup libgit2 compatibility directory
run: | run: |
$CompatDir = "libgit2-${{ env.LIBGIT2_VERSION }}" $CompatDir = "libgit2-${{ env.LIBGIT2_VERSION }}"
@@ -458,6 +448,7 @@ jobs:
"$CompatDir\lib\git2.dll" "$CompatDir\lib\git2.dll"
Write-Host "libgit2 compatibility layout:" Write-Host "libgit2 compatibility layout:"
Get-ChildItem ` Get-ChildItem `
$CompatDir ` $CompatDir `
-Recurse | -Recurse |
@@ -529,8 +520,8 @@ jobs:
-Force -Force
shell: pwsh shell: pwsh
# ── 13. Extract Version & Compress ──────────────────────────────────── # ── 13. Extract Fritzing version ──────────────────────────────────────
- name: Extract Fritzing Version & Zip - name: Extract Fritzing Version
run: | run: |
$verFile = "fritzing-app\src\version\version.cpp" $verFile = "fritzing-app\src\version\version.cpp"
@@ -558,16 +549,22 @@ jobs:
echo "FRITZING_VER=$versionStr" >> $env:GITHUB_ENV 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 ` Compress-Archive `
-Path "release64\*" ` -Path "release64\*" `
-DestinationPath $zipName -DestinationPath $zipName
echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV echo "BASE_ZIP_FILE=$zipName" >> $env:GITHUB_ENV
shell: pwsh shell: pwsh
# ── 14. Compile Online Installer ────────────────────────────────────── # ── 15. Prepare Online Installer ──────────────────────────────────────
- name: Zip fritzing-parts for Online Installer - name: Zip fritzing-parts for Online Installer
run: | run: |
git clone ` git clone `
@@ -595,7 +592,7 @@ jobs:
-Force -Force
shell: pwsh shell: pwsh
- name: Compile Online Setup (Downloads parts) - name: Compile Online Setup
run: | run: |
Copy-Item ` Copy-Item `
"fritzing-build\fritzing_setup.iss" ` "fritzing-build\fritzing_setup.iss" `
@@ -616,7 +613,7 @@ jobs:
>> $env:GITHUB_ENV >> $env:GITHUB_ENV
shell: pwsh shell: pwsh
# ── 15. Bundle fritzing-parts for Offline usage ─────────────────────── # ── 16. Bundle fritzing-parts for Offline/Portable ────────────────────
- name: Clone fritzing-parts into release64 - name: Clone fritzing-parts into release64
run: | run: |
git clone \ git clone \
@@ -630,7 +627,7 @@ jobs:
https://github.com/fritzing/fritzing-parts.git https://github.com/fritzing/fritzing-parts.git
shell: bash shell: bash
# ── 16. Compile Portable ZIP ────────────────────────────────────────── # ── 17. Create Portable ZIP ────────────────────────────────────────────
- name: Compress Portable ZIP - name: Compress Portable ZIP
run: | run: |
$zipName = ` $zipName = `
@@ -648,8 +645,8 @@ jobs:
echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV
shell: pwsh shell: pwsh
# ── 17. Compile Offline Installer ───────────────────────────────────── # ── 18. Compile Offline Installer ─────────────────────────────────────
- name: Compile Offline Setup (Bundled parts) - name: Compile Offline Setup
run: | run: |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" ` & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" `
/dMyAppVersion="$env:FRITZING_VER" ` /dMyAppVersion="$env:FRITZING_VER" `
@@ -661,7 +658,31 @@ jobs:
>> $env:GITHUB_ENV >> $env:GITHUB_ENV
shell: pwsh 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 - name: Create GitHub Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
@@ -669,9 +690,10 @@ jobs:
tag_name: ${{ env.FRITZING_VER }} tag_name: ${{ env.FRITZING_VER }}
name: "Fritzing ${{ env.FRITZING_VER }}" name: "Fritzing ${{ env.FRITZING_VER }}"
files: | files: |
${{ env.BASE_ZIP_FILE }}
${{ env.ZIP_FILE }} ${{ env.ZIP_FILE }}
${{ env.ONLINE_SETUP_FILE }} ${{ env.ONLINE_SETUP_FILE }}
${{ env.OFFLINE_SETUP_FILE }} ${{ env.OFFLINE_SETUP_FILE }}
fritzing-parts.zip fritzing-parts.zip
draft: true draft: true
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}