Update Windows CI workflow for libgit2 and comments

Added LIBGIT2_VERSION environment variable and updated comments for clarity. Modified commands for consistency and improved readability.
This commit is contained in:
jpcozar
2026-08-29 11:34:10 +02:00
committed by GitHub
parent 13dcf9fb49
commit 3c32ce308a
+420 -127
View File
@@ -8,6 +8,7 @@ on:
env: env:
QT_VERSION: '6.8.3' QT_VERSION: '6.8.3'
QT_ARCH: 'win64_msvc2022_64' QT_ARCH: 'win64_msvc2022_64'
LIBGIT2_VERSION: '1.7.1'
jobs: jobs:
build: build:
@@ -37,7 +38,8 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1 uses: ilammy/msvc-dev-cmd@v1
with: with:
arch: amd64 arch: amd64
# ── 2. Install Qt ────────────────────────────────────────────────────
# ── 2. Install Qt ─────────────────────────────────────────────────────
- name: Install Qt - name: Install Qt
uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
with: with:
@@ -48,7 +50,11 @@ jobs:
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
@@ -62,14 +68,16 @@ jobs:
boost_1_85_0 boost_1_85_0
svgpp-1.3.1 svgpp-1.3.1
ngspice-42 ngspice-42
key: deps-manual-v1-${{ runner.os }}-qt-${{ env.QT_VERSION }} key: deps-manual-v3-shared-git2-${{ runner.os }}-qt-${{ env.QT_VERSION }}
# ── 4. Build ZLib ───────────────────────────────────────────────────── # ── 4. Build ZLib ─────────────────────────────────────────────────────
- name: Download ZLib - name: Download ZLib
if: steps.deps-cache.outputs.cache-hit != 'true' if: steps.deps-cache.outputs.cache-hit != 'true'
run: | run: |
Invoke-WebRequest -Uri "https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz" ` Invoke-WebRequest `
-Uri "https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz" `
-OutFile zlib.tar.gz -OutFile zlib.tar.gz
tar -xzf zlib.tar.gz tar -xzf zlib.tar.gz
Rename-Item zlib-1.3 zlib Rename-Item zlib-1.3 zlib
Remove-Item zlib.tar.gz Remove-Item zlib.tar.gz
@@ -86,40 +94,79 @@ jobs:
copy zconf.h .. copy zconf.h ..
shell: cmd shell: cmd
# ── 5. Build libgit2 ────────────────────────────────────────────────── # ── 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: git clone --depth 1 https://github.com/libgit2/libgit2.git libgit2 run: |
shell: bash git clone `
--branch "v${{ env.LIBGIT2_VERSION }}" `
--depth 1 `
https://github.com/libgit2/libgit2.git `
libgit2
shell: pwsh
- name: Build libgit2 - name: Build libgit2 shared
if: steps.deps-cache.outputs.cache-hit != 'true' if: steps.deps-cache.outputs.cache-hit != 'true'
working-directory: libgit2 working-directory: libgit2
run: | run: |
set ZLIB_ROOT=%GITHUB_WORKSPACE%\zlib set ZLIB_ROOT=%GITHUB_WORKSPACE%\zlib
mkdir build64 mkdir build64
cd build64 cd build64
cmake -G "NMake Makefiles" ^ cmake -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_BUILD_TYPE=Release ^
-DBUILD_SHARED_LIBS=OFF ^ -DBUILD_SHARED_LIBS=ON ^
-DBUILD_TESTS=OFF ^ -DBUILD_TESTS=OFF ^
-DBUILD_CLI=OFF ^
-DUSE_BUNDLED_ZLIB=OFF ^ -DUSE_BUNDLED_ZLIB=OFF ^
-DZLIB_LIBRARY="%ZLIB_ROOT%\build\zlibstatic.lib" ^ -DZLIB_LIBRARY="%ZLIB_ROOT%\build\zlibstatic.lib" ^
-DZLIB_INCLUDE_DIR="%ZLIB_ROOT%" ^ -DZLIB_INCLUDE_DIR="%ZLIB_ROOT%" ^
.. ..
nmake nmake
mkdir Release
copy git2.lib Release\
shell: cmd shell: cmd
- 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" |
Select-Object -First 1
$GitDll = Get-ChildItem "libgit2\build64" `
-Recurse `
-Filter "git2.dll" |
Select-Object -First 1
if (-not $GitLib) {
throw "git2.lib was not produced"
}
if (-not $GitDll) {
throw "git2.dll was not produced"
}
Write-Host "Import library: $($GitLib.FullName)"
Write-Host "DLL: $($GitDll.FullName)"
shell: pwsh
# ── 6. Build QuaZip ─────────────────────────────────────────────────── # ── 6. Build QuaZip ───────────────────────────────────────────────────
- name: Download QuaZip - name: Download QuaZip
if: steps.deps-cache.outputs.cache-hit != 'true' if: steps.deps-cache.outputs.cache-hit != 'true'
run: | run: |
Invoke-WebRequest -Uri "https://github.com/stachenov/quazip/archive/refs/tags/v1.4.tar.gz" ` Invoke-WebRequest `
-Uri "https://github.com/stachenov/quazip/archive/refs/tags/v1.4.tar.gz" `
-OutFile quazip.tar.gz -OutFile quazip.tar.gz
tar -xzf quazip.tar.gz tar -xzf quazip.tar.gz
# GitHub archives extract as quazip-1.4 by default
Remove-Item quazip.tar.gz Remove-Item quazip.tar.gz
shell: pwsh shell: pwsh
@@ -128,12 +175,16 @@ jobs:
working-directory: quazip-1.4 working-directory: quazip-1.4
run: | run: |
$ZlibRoot = "$env:GITHUB_WORKSPACE\zlib" $ZlibRoot = "$env:GITHUB_WORKSPACE\zlib"
New-Item -ItemType Directory -Force -Path build New-Item -ItemType Directory -Force -Path build
Push-Location build Push-Location build
cmake -G "NMake Makefiles" ` cmake -G "NMake Makefiles" `
-DZLIB_LIBRARY="$ZlibRoot\build\zlibstatic.lib" ` -DZLIB_LIBRARY="$ZlibRoot\build\zlibstatic.lib" `
-DZLIB_INCLUDE_DIR="$ZlibRoot" ` -DZLIB_INCLUDE_DIR="$ZlibRoot" `
-DCMAKE_BUILD_TYPE=Release .. -DCMAKE_BUILD_TYPE=Release `
..
nmake nmake
Pop-Location Pop-Location
shell: pwsh shell: pwsh
@@ -142,54 +193,94 @@ jobs:
if: steps.deps-cache.outputs.cache-hit != 'true' if: steps.deps-cache.outputs.cache-hit != 'true'
run: | run: |
$QuazipSibling = "quazip-${{ env.QT_VERSION }}-1.4intuisphere" $QuazipSibling = "quazip-${{ env.QT_VERSION }}-1.4intuisphere"
New-Item -ItemType Directory -Force -Path "$QuazipSibling\lib"
New-Item -ItemType Directory -Force -Path "$QuazipSibling\include\QuaZip-Qt6-1.4\quazip"
# Copy built libraries New-Item -ItemType Directory -Force `
Copy-Item "quazip-1.4\build\quazip\quazip1-qt6.lib" "$QuazipSibling\lib\" -Path "$QuazipSibling\lib"
Copy-Item "quazip-1.4\build\quazip\quazip1-qt6.dll" "$QuazipSibling\lib\" -ErrorAction SilentlyContinue
# Copy header files New-Item -ItemType Directory -Force `
Copy-Item "quazip-1.4\quazip\*.h" "$QuazipSibling\include\QuaZip-Qt6-1.4\quazip\" -Path "$QuazipSibling\include\QuaZip-Qt6-1.4\quazip"
Copy-Item `
"quazip-1.4\build\quazip\quazip1-qt6.lib" `
"$QuazipSibling\lib\"
Copy-Item `
"quazip-1.4\build\quazip\quazip1-qt6.dll" `
"$QuazipSibling\lib\" `
-ErrorAction SilentlyContinue
Copy-Item `
"quazip-1.4\quazip\*.h" `
"$QuazipSibling\include\QuaZip-Qt6-1.4\quazip\"
shell: pwsh shell: pwsh
# ── 7. Setup Clipper ────────────────────────────────────────────────── # ── 7. Setup Clipper ──────────────────────────────────────────────────
- name: Download and build Clipper - name: Download and build Clipper
if: steps.deps-cache.outputs.cache-hit != 'true' if: steps.deps-cache.outputs.cache-hit != 'true'
run: | run: |
curl.exe -L -o clipper.zip "https://sourceforge.net/projects/polyclipping/files/clipper_ver6.4.2.zip/download" curl.exe -L `
Expand-Archive -Path clipper.zip -DestinationPath clipper-src -o clipper.zip `
"https://sourceforge.net/projects/polyclipping/files/clipper_ver6.4.2.zip/download"
Expand-Archive `
-Path clipper.zip `
-DestinationPath clipper-src
Remove-Item clipper.zip Remove-Item clipper.zip
# Create the expected directory structure New-Item -ItemType Directory -Force `
New-Item -ItemType Directory -Force -Path "Clipper1-6.4.2\include\polyclipping" -Path "Clipper1-6.4.2\include\polyclipping"
New-Item -ItemType Directory -Force -Path "Clipper1-6.4.2\lib"
# Find and copy source files New-Item -ItemType Directory -Force `
$cppDir = Get-ChildItem -Path "clipper-src" -Recurse -Filter "clipper.hpp" | -Path "Clipper1-6.4.2\lib"
Select-Object -First 1 -ExpandProperty DirectoryName
if ($cppDir) { $cppDir = Get-ChildItem `
Copy-Item "$cppDir\clipper.hpp" "Clipper1-6.4.2\include\polyclipping\" -Path "clipper-src" `
Copy-Item "$cppDir\clipper.cpp" "Clipper1-6.4.2\include\polyclipping\" -Recurse `
-Filter "clipper.hpp" |
Select-Object -First 1 -ExpandProperty DirectoryName
if (-not $cppDir) {
throw "clipper.hpp not found"
} }
# Build clipper as a static library Copy-Item `
"$cppDir\clipper.hpp" `
"Clipper1-6.4.2\include\polyclipping\"
Copy-Item `
"$cppDir\clipper.cpp" `
"Clipper1-6.4.2\include\polyclipping\"
Push-Location "Clipper1-6.4.2" Push-Location "Clipper1-6.4.2"
cl /c /O2 /EHsc /MD /Iinclude\polyclipping include\polyclipping\clipper.cpp
cl /c /O2 /EHsc /MD `
/Iinclude\polyclipping `
include\polyclipping\clipper.cpp
lib /OUT:polyclipping.lib clipper.obj lib /OUT:polyclipping.lib clipper.obj
Move-Item polyclipping.lib lib\ Move-Item polyclipping.lib lib\
Remove-Item clipper.obj -ErrorAction SilentlyContinue
Remove-Item clipper.obj `
-ErrorAction SilentlyContinue
Pop-Location Pop-Location
Remove-Item "clipper-src" -Recurse -Force -ErrorAction SilentlyContinue Remove-Item "clipper-src" `
-Recurse `
-Force `
-ErrorAction SilentlyContinue
shell: pwsh shell: pwsh
# ── 8. Download header-only and pre-built dependencies ──────────────── # ── 8. Header-only and pre-built dependencies ─────────────────────────
- name: Download Boost - name: Download Boost
if: steps.deps-cache.outputs.cache-hit != 'true' if: steps.deps-cache.outputs.cache-hit != 'true'
run: | run: |
Invoke-WebRequest -Uri "https://archives.boost.io/release/1.85.0/source/boost_1_85_0.tar.gz" ` Invoke-WebRequest `
-Uri "https://archives.boost.io/release/1.85.0/source/boost_1_85_0.tar.gz" `
-OutFile boost.tar.gz -OutFile boost.tar.gz
tar -xzf boost.tar.gz tar -xzf boost.tar.gz
Remove-Item boost.tar.gz Remove-Item boost.tar.gz
shell: pwsh shell: pwsh
@@ -197,8 +288,10 @@ jobs:
- name: Download SVG++ - name: Download SVG++
if: steps.deps-cache.outputs.cache-hit != 'true' if: steps.deps-cache.outputs.cache-hit != 'true'
run: | run: |
Invoke-WebRequest -Uri "https://github.com/svgpp/svgpp/archive/refs/tags/v1.3.1.tar.gz" ` Invoke-WebRequest `
-Uri "https://github.com/svgpp/svgpp/archive/refs/tags/v1.3.1.tar.gz" `
-OutFile svgpp.tar.gz -OutFile svgpp.tar.gz
tar -xzf svgpp.tar.gz tar -xzf svgpp.tar.gz
Remove-Item svgpp.tar.gz Remove-Item svgpp.tar.gz
shell: pwsh shell: pwsh
@@ -206,75 +299,175 @@ jobs:
- name: Download ngspice - name: Download ngspice
if: steps.deps-cache.outputs.cache-hit != 'true' if: steps.deps-cache.outputs.cache-hit != 'true'
run: | run: |
curl.exe -L -o ngspice.7z "https://sourceforge.net/projects/ngspice/files/ng-spice-rework/old-releases/42/ngspice-42_dll_64.7z/download" curl.exe -L `
-o ngspice.7z `
"https://sourceforge.net/projects/ngspice/files/ng-spice-rework/old-releases/42/ngspice-42_dll_64.7z/download"
7z x ngspice.7z -ongspice-extract 7z x ngspice.7z -ongspice-extract
# Move contents to expected location
if (Test-Path "ngspice-extract\Spice64_dll") { if (Test-Path "ngspice-extract\Spice64_dll") {
Move-Item "ngspice-extract\Spice64_dll" "ngspice-42" Move-Item `
} elseif (Test-Path "ngspice-extract\ngspice-42") { "ngspice-extract\Spice64_dll" `
Move-Item "ngspice-extract\ngspice-42" . "ngspice-42"
} else {
Rename-Item "ngspice-extract" "ngspice-42"
} }
Remove-Item ngspice.7z -ErrorAction SilentlyContinue elseif (Test-Path "ngspice-extract\ngspice-42") {
Remove-Item ngspice-extract -Recurse -Force -ErrorAction SilentlyContinue Move-Item `
"ngspice-extract\ngspice-42" `
.
}
else {
Rename-Item `
"ngspice-extract" `
"ngspice-42"
}
Remove-Item ngspice.7z `
-ErrorAction SilentlyContinue
Remove-Item ngspice-extract `
-Recurse `
-Force `
-ErrorAction SilentlyContinue
shell: pwsh shell: pwsh
# ── 9. Verify directory structure ───────────────────────────────────── # ── 9. Verify dependency structure ────────────────────────────────────
- name: Verify dependency layout - name: Verify dependency layout
run: | run: |
echo "=== Directory Structure ===" Write-Host "=== Directory Structure ==="
echo "--- libgit2 ---"
Get-ChildItem "libgit2\include\git2.h" -ErrorAction SilentlyContinue Write-Host "--- libgit2 ---"
Get-ChildItem "libgit2\build64\Release\git2.lib" -ErrorAction SilentlyContinue Get-ChildItem `
echo "--- QuaZip ---" "libgit2\include\git2.h" `
-ErrorAction SilentlyContinue
Get-ChildItem `
"libgit2\build64" `
-Recurse `
-Filter "git2.lib" `
-ErrorAction SilentlyContinue
Get-ChildItem `
"libgit2\build64" `
-Recurse `
-Filter "git2.dll" `
-ErrorAction SilentlyContinue
Write-Host "--- QuaZip ---"
$qz = "quazip-${{ env.QT_VERSION }}-1.4intuisphere" $qz = "quazip-${{ env.QT_VERSION }}-1.4intuisphere"
Get-ChildItem "$qz\lib\*" -ErrorAction SilentlyContinue
Get-ChildItem "$qz\include\QuaZip-Qt6-1.4\quazip\*.h" -ErrorAction SilentlyContinue | Select-Object -First 3 Get-ChildItem `
echo "--- Clipper ---" "$qz\lib\*" `
Get-ChildItem "Clipper1-6.4.2\include\polyclipping\*" -ErrorAction SilentlyContinue -ErrorAction SilentlyContinue
Get-ChildItem "Clipper1-6.4.2\lib\*" -ErrorAction SilentlyContinue
echo "--- Boost ---" Get-ChildItem `
"$qz\include\QuaZip-Qt6-1.4\quazip\*.h" `
-ErrorAction SilentlyContinue |
Select-Object -First 3
Write-Host "--- Clipper ---"
Get-ChildItem `
"Clipper1-6.4.2\include\polyclipping\*" `
-ErrorAction SilentlyContinue
Get-ChildItem `
"Clipper1-6.4.2\lib\*" `
-ErrorAction SilentlyContinue
Write-Host "--- Boost ---"
Test-Path "boost_1_85_0\boost\version.hpp" Test-Path "boost_1_85_0\boost\version.hpp"
echo "--- SVG++ ---"
Write-Host "--- SVG++ ---"
Test-Path "svgpp-1.3.1\include" Test-Path "svgpp-1.3.1\include"
echo "--- ngspice ---"
Write-Host "--- ngspice ---"
Test-Path "ngspice-42\include" Test-Path "ngspice-42\include"
shell: pwsh shell: pwsh
# ── 10. Configure Fritzing (qmake) ─────────────────────────────────── # ── 10. Configure Fritzing ────────────────────────────────────────────
- name: Clean qmake cache - name: Clean qmake cache
working-directory: fritzing-app working-directory: fritzing-app
run: | run: |
if (Test-Path .qmake.cache) { Remove-Item .qmake.cache } if (Test-Path .qmake.cache) {
if (Test-Path .qmake.stash) { Remove-Item .qmake.stash } Remove-Item .qmake.cache
shell: pwsh
- name: Setup libgit2 compatibility directory
run: |
if (Test-Path "libgit2-1.7.1") {
Remove-Item "libgit2-1.7.1" -Recurse -Force
} }
New-Item -ItemType Directory -Force -Path "libgit2-1.7.1\include" if (Test-Path .qmake.stash) {
New-Item -ItemType Directory -Force -Path "libgit2-1.7.1\lib" Remove-Item .qmake.stash
}
Copy-Item "libgit2\include\*" "libgit2-1.7.1\include\" -Recurse
Copy-Item "libgit2\build64\Release\git2.lib" "libgit2-1.7.1\lib\git2.lib"
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
run: |
$CompatDir = "libgit2-${{ env.LIBGIT2_VERSION }}"
if (Test-Path $CompatDir) {
Remove-Item `
$CompatDir `
-Recurse `
-Force
}
New-Item `
-ItemType Directory `
-Force `
-Path "$CompatDir\include"
New-Item `
-ItemType Directory `
-Force `
-Path "$CompatDir\lib"
Copy-Item `
"libgit2\include\*" `
"$CompatDir\include\" `
-Recurse
$GitLib = Get-ChildItem `
"libgit2\build64" `
-Recurse `
-Filter "git2.lib" |
Select-Object -First 1
$GitDll = Get-ChildItem `
"libgit2\build64" `
-Recurse `
-Filter "git2.dll" |
Select-Object -First 1
if (-not $GitLib) {
throw "git2.lib not found"
}
if (-not $GitDll) {
throw "git2.dll not found"
}
Copy-Item `
$GitLib.FullName `
"$CompatDir\lib\git2.lib"
Copy-Item `
$GitDll.FullName `
"$CompatDir\lib\git2.dll"
Write-Host "libgit2 compatibility layout:"
Get-ChildItem `
$CompatDir `
-Recurse |
Select-Object FullName
shell: pwsh
- name: Configure Fritzing (qmake) - name: Configure Fritzing (qmake)
working-directory: fritzing-app working-directory: fritzing-app
run: | run: |
$ZlibLib = "$env:GITHUB_WORKSPACE\zlib\build" qmake phoenix.pro
# Static libgit2 needs its transitive deps linked into the final executable:
# zlibstatic – zlib symbols (deflate, inflate, crc32 …)
# advapi32 – registry, crypto, SID/token APIs
# winhttp – WinHTTP transport
# crypt32 – certificate APIs
# ole32 – COM (CoInitializeEx …)
# rpcrt4 – UuidCreate
qmake phoenix.pro `
"LIBS+=-L$ZlibLib -lzlibstatic -ladvapi32 -lwinhttp -lcrypt32 -lole32 -lrpcrt4"
shell: pwsh shell: pwsh
- name: Build Fritzing (nmake) - name: Build Fritzing (nmake)
@@ -282,93 +475,193 @@ jobs:
run: nmake release run: nmake release
shell: cmd shell: cmd
# ── 11. Deploy Qt runtime DLLs ─────────────────────────────────────── # ── 11. Deploy Qt runtime DLLs ────────────────────────────────────────
- name: Deploy Qt (windeployqt) - name: Deploy Qt (windeployqt)
working-directory: release64 working-directory: release64
run: windeployqt Fritzing.exe run: |
windeployqt Fritzing.exe
shell: cmd shell: cmd
# ── 12. Copy Third-Party DLLs & Runtime Data ────────────────────────── # ── 12. Copy Third-Party DLLs & Runtime Data ──────────────────────────
- name: Copy third-party DLLs and data folders - name: Copy third-party DLLs and data folders
run: | run: |
# Copy extra DLLs # QuaZip
Copy-Item "quazip-${{ env.QT_VERSION }}-1.4intuisphere\lib\*.dll" "release64\" -ErrorAction SilentlyContinue Copy-Item `
Copy-Item "ngspice-42\*.dll" "release64\" -ErrorAction SilentlyContinue "quazip-${{ env.QT_VERSION }}-1.4intuisphere\lib\*.dll" `
Copy-Item "$env:QT_ROOT_DIR\bin\Qt6Core5Compat.dll" "release64\" -ErrorAction SilentlyContinue "release64\" `
-ErrorAction SilentlyContinue
# Fritzing needs these folders alongside the .exe to run # libgit2
# (Note: fritzing-parts is purposefully omitted to shave 300MB; it will be downloaded by the setup) Copy-Item `
Copy-Item "fritzing-app\help" "release64\" -Recurse -Force "libgit2-${{ env.LIBGIT2_VERSION }}\lib\git2.dll" `
Copy-Item "fritzing-app\sketches" "release64\" -Recurse -Force "release64\" `
Copy-Item "fritzing-app\translations" "release64\" -Recurse -Force -Force
# ngspice
Copy-Item `
"ngspice-42\*.dll" `
"release64\" `
-ErrorAction SilentlyContinue
# Qt 5 compatibility runtime
Copy-Item `
"$env:QT_ROOT_DIR\bin\Qt6Core5Compat.dll" `
"release64\" `
-ErrorAction SilentlyContinue
# Runtime data
Copy-Item `
"fritzing-app\help" `
"release64\" `
-Recurse `
-Force
Copy-Item `
"fritzing-app\sketches" `
"release64\" `
-Recurse `
-Force
Copy-Item `
"fritzing-app\translations" `
"release64\" `
-Recurse `
-Force
shell: pwsh shell: pwsh
# ── 13. Extract Version & Compress ─────────────────────────────────── # ── 13. Extract Version & Compress ────────────────────────────────────
- name: Extract Fritzing Version & Zip - name: Extract Fritzing Version & Zip
run: | run: |
$verFile = "fritzing-app\src\version\version.cpp" $verFile = "fritzing-app\src\version\version.cpp"
$content = Get-Content -Raw -Path $verFile
$major = ([regex]'m_majorVersion\("(.*?)"\)').Match($content).Groups[1].Value $content = Get-Content `
$minor = ([regex]'m_minorVersion\("(.*?)"\)').Match($content).Groups[1].Value -Raw `
$patch = ([regex]'m_minorSubVersion\("(.*?)"\)').Match($content).Groups[1].Value -Path $verFile
$mod = ([regex]'m_modifier\("(.*?)"\)').Match($content).Groups[1].Value
$major = (
[regex]'m_majorVersion\("(.*?)"\)'
).Match($content).Groups[1].Value
$minor = (
[regex]'m_minorVersion\("(.*?)"\)'
).Match($content).Groups[1].Value
$patch = (
[regex]'m_minorSubVersion\("(.*?)"\)'
).Match($content).Groups[1].Value
$mod = (
[regex]'m_modifier\("(.*?)"\)'
).Match($content).Groups[1].Value
$versionStr = "$major.$minor.$patch$mod" $versionStr = "$major.$minor.$patch$mod"
echo "FRITZING_VER=$versionStr" >> $env:GITHUB_ENV echo "FRITZING_VER=$versionStr" >> $env:GITHUB_ENV
$zipName = "Fritzing-$versionStr-Windows-x64.zip" $zipName = "Fritzing-$versionStr-Windows-x64.zip"
Compress-Archive -Path "release64\*" -DestinationPath $zipName
Compress-Archive `
-Path "release64\*" `
-DestinationPath $zipName
echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV
shell: pwsh shell: pwsh
# ── 14. Compile Online Installer (Slim) ────────────────────────────── # ── 14. Compile Online Installer ──────────────────────────────────────
- name: Zip fritzing-parts for Online Installer - name: Zip fritzing-parts for Online Installer
run: | run: |
# Clone from local checkout → guarantees a proper .git, no re-download git clone `
git clone --no-hardlinks fritzing-parts fritzing-parts-zip/fritzing-parts --no-hardlinks `
# Fix remote URL: local clone points origin to CI-local path; must point to GitHub fritzing-parts `
git -C fritzing-parts-zip/fritzing-parts remote set-url origin https://github.com/fritzing/fritzing-parts.git fritzing-parts-zip/fritzing-parts
git `
-C fritzing-parts-zip/fritzing-parts `
remote set-url origin `
https://github.com/fritzing/fritzing-parts.git
Push-Location fritzing-parts-zip Push-Location fritzing-parts-zip
7z a -tzip ..\fritzing-parts.zip fritzing-parts
7z a `
-tzip `
..\fritzing-parts.zip `
fritzing-parts
Pop-Location Pop-Location
Remove-Item fritzing-parts-zip -Recurse -Force
Remove-Item `
fritzing-parts-zip `
-Recurse `
-Force
shell: pwsh shell: pwsh
- name: Compile Online Setup (Downloads parts) - name: Compile Online Setup (Downloads parts)
run: | run: |
Copy-Item "fritzing-build\fritzing_setup.iss" ".\" -Force Copy-Item `
$PartsUrl = "https://github.com/${{ github.repository }}/releases/download/$env:FRITZING_VER/fritzing-parts.zip" "fritzing-build\fritzing_setup.iss" `
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /dMyAppVersion="$env:FRITZING_VER" /dOnlineInstaller=1 /dPartsDownloadUrl="$PartsUrl" "fritzing_setup.iss" ".\" `
echo "ONLINE_SETUP_FILE=Fritzing-$env:FRITZING_VER-OnlineSetup-Windows-x64.exe" >> $env:GITHUB_ENV -Force
$PartsUrl = `
"https://github.com/${{ github.repository }}/releases/download/$env:FRITZING_VER/fritzing-parts.zip"
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" `
/dMyAppVersion="$env:FRITZING_VER" `
/dOnlineInstaller=1 `
/dPartsDownloadUrl="$PartsUrl" `
"fritzing_setup.iss"
echo `
"ONLINE_SETUP_FILE=Fritzing-$env:FRITZING_VER-OnlineSetup-Windows-x64.exe" `
>> $env:GITHUB_ENV
shell: pwsh shell: pwsh
# ── 15. Bundle fritzing-parts for Offline usage ────────────────────── # ── 15. Bundle fritzing-parts for Offline usage ───────────────────────
- name: Clone fritzing-parts into release64 - name: Clone fritzing-parts into release64
run: | run: |
# Clone from local checkout → guarantees a proper .git, no re-download git clone \
git clone --no-hardlinks fritzing-parts release64/fritzing-parts --no-hardlinks \
# Fix remote URL: local clone points origin to CI-local path; must point to GitHub fritzing-parts \
git -C release64/fritzing-parts remote set-url origin https://github.com/fritzing/fritzing-parts.git release64/fritzing-parts
git \
-C release64/fritzing-parts \
remote set-url origin \
https://github.com/fritzing/fritzing-parts.git
shell: bash shell: bash
# ── 16. Compile Portable ZIP ───────────────────────────────────────── # ── 16. Compile Portable ZIP ──────────────────────────────────────────
- name: Compress Portable ZIP - name: Compress Portable ZIP
run: | run: |
$zipName = "Fritzing-$env:FRITZING_VER-Portable-Windows-x64.zip" $zipName = `
"Fritzing-$env:FRITZING_VER-Portable-Windows-x64.zip"
Push-Location release64 Push-Location release64
7z a -tzip "..\$zipName" *
7z a `
-tzip `
"..\$zipName" `
*
Pop-Location Pop-Location
echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV
shell: pwsh shell: pwsh
# ── 17. Compile Offline Installer (Fat) ────────────────────────────── # ── 17. Compile Offline Installer ─────────────────────────────────────
- name: Compile Offline Setup (Bundled parts) - name: Compile Offline Setup (Bundled parts)
run: | run: |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /dMyAppVersion="$env:FRITZING_VER" /dOnlineInstaller=0 "fritzing_setup.iss" & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" `
echo "OFFLINE_SETUP_FILE=Fritzing-$env:FRITZING_VER-OfflineSetup-Windows-x64.exe" >> $env:GITHUB_ENV /dMyAppVersion="$env:FRITZING_VER" `
/dOnlineInstaller=0 `
"fritzing_setup.iss"
echo `
"OFFLINE_SETUP_FILE=Fritzing-$env:FRITZING_VER-OfflineSetup-Windows-x64.exe" `
>> $env:GITHUB_ENV
shell: pwsh shell: pwsh
# ── 19. Create GitHub Release ──────────────────────────────────────── # ── 18. Create GitHub Release ─────────────────────────────────────────
- 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'