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 shell: pwsh
# ── 14. Compile Online Installer (Slim) ────────────────────────────── # ── 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) - name: Compile Online Setup (Downloads parts)
run: | run: |
Copy-Item "fritzing-build\fritzing_setup.iss" ".\" -Force 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 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: Copy fritzing-parts into release64 - name: Copy fritzing-parts into release64
run: | run: |
# Remove the heavy .git folder before copying the parts database # Copy the full database (including .git) into release64 for the Offline Zip/Installer
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-Item "fritzing-parts" "release64\" -Recurse -Force Copy-Item "fritzing-parts" "release64\" -Recurse -Force
shell: pwsh shell: pwsh
@@ -361,5 +365,6 @@ jobs:
${{ 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
draft: true draft: true
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} 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" 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" #if defined(OnlineInstaller) && OnlineInstaller == "1"
#ifndef PartsDownloadUrl
#define PartsDownloadUrl "https://github.com/fritzing/fritzing-parts/archive/refs/heads/master.zip"
#endif
[Code] [Code]
var var
DownloadPage: TDownloadWizardPage; DownloadPage: TDownloadWizardPage;
@@ -87,7 +91,7 @@ begin
if CurPageID = wpReady then begin if CurPageID = wpReady then begin
DownloadPage.Clear; DownloadPage.Clear;
DownloadPage.Add( DownloadPage.Add(
'https://github.com/fritzing/fritzing-parts/archive/refs/heads/master.zip', '{#PartsDownloadUrl}',
'fritzing-parts.zip', ''); 'fritzing-parts.zip', '');
DownloadPage.Show; DownloadPage.Show;
try try
@@ -134,16 +138,20 @@ begin
'', SW_HIDE, ewWaitUntilTerminated, ResultCode) then '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin begin
// GitHub's archive names the folder 'fritzing-parts-master'; rename to 'fritzing-parts' // GitHub's archive names the folder 'fritzing-parts-master'; rename to 'fritzing-parts'
RenameFile( // Zips created manually will already extract to 'fritzing-parts'
ExpandConstant('{app}\fritzing-parts-master'), if DirExists(ExpandConstant('{app}\fritzing-parts-master')) then
ExpandConstant('{app}\fritzing-parts')); begin
Log('fritzing-parts extracted and renamed successfully.'); RenameFile(
ExpandConstant('{app}\fritzing-parts-master'),
ExpandConstant('{app}\fritzing-parts'));
end;
Log('fritzing-parts extracted successfully.');
end else begin end else begin
Log('tar.exe failed with exit code: ' + IntToStr(ResultCode)); Log('tar.exe failed with exit code: ' + IntToStr(ResultCode));
SuppressibleMsgBox( SuppressibleMsgBox(
'Failed to extract the parts database (tar exit code: ' + IntToStr(ResultCode) + ').' + #13#10 + 'Failed to extract the parts database (tar exit code: ' + IntToStr(ResultCode) + ').' + #13#10 +
'You can manually download and extract it from:' + #13#10 + 'You can manually download and extract it from:' + #13#10 +
'https://github.com/fritzing/fritzing-parts', '{#PartsDownloadUrl}',
mbError, MB_OK, IDOK); mbError, MB_OK, IDOK);
end; end;