From b79b5e0c6b0cd1b5d3c1c31ea13f0de84c174905 Mon Sep 17 00:00:00 2001 From: rzlamrr Date: Mon, 16 Mar 2026 14:59:19 +0700 Subject: [PATCH] build: enhance parts download configurability in Inno Setup script --- .github/workflows/windows.yml | 13 +++++++++---- fritzing_setup.iss | 22 +++++++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index bd72020..da5d995 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -311,19 +311,23 @@ jobs: shell: pwsh # ── 14. Compile Online Installer (Slim) ────────────────────────────── + - name: Zip fritzing-parts for Online Installer + run: | + Compress-Archive -Path "fritzing-parts" -DestinationPath "fritzing-parts.zip" + shell: pwsh + - name: Compile Online Setup (Downloads parts) run: | Copy-Item "fritzing-build\fritzing_setup.iss" ".\" -Force - & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /dMyAppVersion="$env:FRITZING_VER" /dOnlineInstaller=1 "fritzing_setup.iss" + $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 # ── 15. Bundle fritzing-parts for Offline usage ────────────────────── - name: Copy fritzing-parts into release64 run: | - # Remove the heavy .git folder before copying the parts database - if (Test-Path "fritzing-parts\.git") { Remove-Item "fritzing-parts\.git" -Recurse -Force } - # Now we copy the full database into release64 for the Offline Zip/Installer + # Copy the full database (including .git) into release64 for the Offline Zip/Installer Copy-Item "fritzing-parts" "release64\" -Recurse -Force shell: pwsh @@ -361,5 +365,6 @@ jobs: ${{ env.ZIP_FILE }} ${{ env.ONLINE_SETUP_FILE }} ${{ env.OFFLINE_SETUP_FILE }} + fritzing-parts.zip draft: true token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} diff --git a/fritzing_setup.iss b/fritzing_setup.iss index 5bba589..743f6aa 100644 --- a/fritzing_setup.iss +++ b/fritzing_setup.iss @@ -66,9 +66,13 @@ Filename: "{app}\Fritzing.exe"; Description: "{cm:LaunchProgram,Fritzing}"; Flag Type: filesandordirs; Name: "{app}\fritzing-parts" ; ────────────────────────────────────────────────────────────────────────────── -; Online Installer: download and extract fritzing-parts during installation +; Online Installer: clone fritzing-parts via git during installation ; ────────────────────────────────────────────────────────────────────────────── #if defined(OnlineInstaller) && OnlineInstaller == "1" +#ifndef PartsDownloadUrl +#define PartsDownloadUrl "https://github.com/fritzing/fritzing-parts/archive/refs/heads/master.zip" +#endif + [Code] var DownloadPage: TDownloadWizardPage; @@ -87,7 +91,7 @@ begin if CurPageID = wpReady then begin DownloadPage.Clear; DownloadPage.Add( - 'https://github.com/fritzing/fritzing-parts/archive/refs/heads/master.zip', + '{#PartsDownloadUrl}', 'fritzing-parts.zip', ''); DownloadPage.Show; try @@ -134,16 +138,20 @@ begin '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then begin // GitHub's archive names the folder 'fritzing-parts-master'; rename to 'fritzing-parts' - RenameFile( - ExpandConstant('{app}\fritzing-parts-master'), - ExpandConstant('{app}\fritzing-parts')); - Log('fritzing-parts extracted and renamed successfully.'); + // Zips created manually will already extract to 'fritzing-parts' + if DirExists(ExpandConstant('{app}\fritzing-parts-master')) then + begin + RenameFile( + ExpandConstant('{app}\fritzing-parts-master'), + ExpandConstant('{app}\fritzing-parts')); + end; + Log('fritzing-parts extracted successfully.'); end else begin Log('tar.exe failed with exit code: ' + IntToStr(ResultCode)); SuppressibleMsgBox( 'Failed to extract the parts database (tar exit code: ' + IntToStr(ResultCode) + ').' + #13#10 + 'You can manually download and extract it from:' + #13#10 + - 'https://github.com/fritzing/fritzing-parts', + '{#PartsDownloadUrl}', mbError, MB_OK, IDOK); end;