feat: Inno Setup installer scripts

This commit is contained in:
rzlamrr
2026-03-16 11:14:47 +07:00
parent 0ec4801ffb
commit 5d9fac67f8
2 changed files with 142 additions and 10 deletions
+44 -10
View File
@@ -286,7 +286,7 @@ jobs:
Copy-Item "$env:QT_ROOT_DIR\bin\Qt6Core5Compat.dll" "release64\" -ErrorAction SilentlyContinue
# Fritzing needs these folders alongside the .exe to run
Copy-Item "fritzing-parts" "release64\" -Recurse -Force
# (Note: fritzing-parts is purposefully omitted to shave 300MB; it will be downloaded by the setup)
Copy-Item "fritzing-app\help" "release64\" -Recurse -Force
Copy-Item "fritzing-app\sketches" "release64\" -Recurse -Force
Copy-Item "fritzing-app\translations" "release64\" -Recurse -Force
@@ -310,21 +310,55 @@ jobs:
echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV
shell: pwsh
# ── 14. Upload build artifact ────────────────────────────────────────
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: Fritzing-${{ env.FRITZING_VER }}-Windows-x64
path: release64/
retention-days: 14
# ── 14. Compile Online Installer (Slim) ──────────────────────────────
- name: Compile Online Setup (Downloads parts)
run: |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /dMyAppVersion="$env:FRITZING_VER" /dOnlineInstaller=1 "fritzing_setup.iss"
echo "ONLINE_SETUP_FILE=Fritzing-$env:FRITZING_VER-OnlineSetup-Windows-x64.exe" >> $env:GITHUB_ENV
shell: pwsh
# ── 15. Create GitHub Release ────────────────────────────────────────
# ── 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-Item "fritzing-parts" "release64\" -Recurse -Force
shell: pwsh
# ── 16. Compile Portable ZIP ─────────────────────────────────────────
- name: Compress Portable ZIP
run: |
$zipName = "Fritzing-$env:FRITZING_VER-Portable-Windows-x64.zip"
Compress-Archive -Path "release64\*" -DestinationPath $zipName
echo "ZIP_FILE=$zipName" >> $env:GITHUB_ENV
shell: pwsh
# ── 17. Compile Offline Installer (Fat) ──────────────────────────────
- name: Compile Offline Setup (Bundled parts)
run: |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /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
# ── 18. Upload build artifact ────────────────────────────────────────
# - name: Upload build artifact
# uses: actions/upload-artifact@v4
# with:
# name: Fritzing-${{ env.FRITZING_VER }}-Windows-x64
# path: release64/
# retention-days: 14
# ── 19. Create GitHub Release ────────────────────────────────────────
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
if: github.ref == 'refs/heads/master'
with:
tag_name: ${{ env.FRITZING_VER }}
name: "Fritzing ${{ env.FRITZING_VER }}"
files: ${{ env.ZIP_FILE }}
files: |
${{ env.ZIP_FILE }}
${{ env.ONLINE_SETUP_FILE }}
${{ env.OFFLINE_SETUP_FILE }}
draft: true
generate_release_notes: false
+98
View File
@@ -0,0 +1,98 @@
[Setup]
AppName=Fritzing
AppVersion={#MyAppVersion}
AppPublisher=Fritzing
AppURL=https://fritzing.org
DefaultDirName={autopf}\Fritzing
DefaultGroupName=Fritzing
OutputDir=.\
#if defined(OnlineInstaller) && OnlineInstaller == 1
OutputBaseFilename=Fritzing-{#MyAppVersion}-OnlineSetup-Windows-x64
#else
OutputBaseFilename=Fritzing-{#MyAppVersion}-OfflineSetup-Windows-x64
#endif
Compression=lzma2
SolidCompression=yes
ArchitecturesInstallIn64BitMode=x64
DisableProgramGroupPage=yes
UninstallDisplayIcon={app}\Fritzing.exe
ChangesAssociations=yes
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "associatefzz"; Description: "Associate .fzz and .fzpz files with Fritzing"; GroupDescription: "File associations:"; Flags: unchecked
[Registry]
Root: HKCR; Subkey: ".fzz"; ValueType: string; ValueName: ""; ValueData: "FritzingProject"; Flags: uninsdeletevalue; Tasks: associatefzz
Root: HKCR; Subkey: ".fzpz"; ValueType: string; ValueName: ""; ValueData: "FritzingPart"; Flags: uninsdeletevalue; Tasks: associatefzz
Root: HKCR; Subkey: "FritzingProject"; ValueType: string; ValueName: ""; ValueData: "Fritzing Sketch"; Flags: uninsdeletekey; Tasks: associatefzz
Root: HKCR; Subkey: "FritzingProject\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\Fritzing.exe,0"; Tasks: associatefzz
Root: HKCR; Subkey: "FritzingProject\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\Fritzing.exe"" ""%1"""; Tasks: associatefzz
Root: HKCR; Subkey: "FritzingPart"; ValueType: string; ValueName: ""; ValueData: "Fritzing Component Part"; Flags: uninsdeletekey; Tasks: associatefzz
Root: HKCR; Subkey: "FritzingPart\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\Fritzing.exe,0"; Tasks: associatefzz
Root: HKCR; Subkey: "FritzingPart\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\Fritzing.exe"" ""%1"""; Tasks: associatefzz
[Files]
; Base files (takes whatever is inside release64. For Online, it's missing fritzing-parts. For Offline, it contains fritzing-parts)
Source: "release64\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\Fritzing"; Filename: "{app}\Fritzing.exe"
Name: "{autodesktop}\Fritzing"; Filename: "{app}\Fritzing.exe"; Tasks: desktopicon
#if defined(OnlineInstaller) && OnlineInstaller == 1
[Code]
var
DownloadPage: TDownloadWizardPage;
procedure InitializeWizard;
begin
DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), nil);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpReady then begin
DownloadPage.Clear;
DownloadPage.Add('https://github.com/fritzing/fritzing-parts/archive/refs/heads/master.zip', 'fritzing-parts.zip', '');
DownloadPage.Show;
try
try
DownloadPage.Download;
except
if DownloadPage.AbortedByUser then
Log('Aborted by user.')
else
MsgBox('Parts database download failed: ' + GetExceptionMessage, mbError, MB_OK);
Result := False;
exit;
end;
finally
DownloadPage.Hide; // Hide the download page when done
end;
end;
Result := True;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
begin
if CurStep = ssPostInstall then
begin
WizardForm.StatusLabel.Caption := 'Extracting Fritzing Parts database... (this may take a minute)';
WizardForm.ProgressGauge.Style := npbstMarquee;
// Use native Windows 10/11 tar to quickly extract the downloaded zip file into {app}
if Exec(ExpandConstant('{cmd}'), '/c tar.exe -xf "' + ExpandConstant('{tmp}\fritzing-parts.zip') + '" -C "' + ExpandConstant('{app}') + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
// GitHub zip names the extracted folder 'fritzing-parts-master', rename it to what Fritzing expects
RenameFile(ExpandConstant('{app}\fritzing-parts-master'), ExpandConstant('{app}\fritzing-parts'));
end else begin
MsgBox('Failed to extract parts database. (tar exit code: ' + IntToStr(ResultCode) + ')', mbError, MB_OK);
end;
WizardForm.ProgressGauge.Style := npbstNormal;
end;
end;
#endif