build: enhance parts download configurability in Inno Setup script

This commit is contained in:
rzlamrr
2026-03-16 14:59:19 +07:00
parent 75b564aa78
commit b79b5e0c6b
2 changed files with 24 additions and 11 deletions
+9 -4
View File
@@ -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 }}
+15 -7
View File
@@ -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;