From f23fb81803aaf42680f948e0cc791d133fad0ea4 Mon Sep 17 00:00:00 2001 From: KlaasWhite Date: Mon, 17 Nov 2025 22:37:47 +0100 Subject: [PATCH] Provide installer for StarMap --- .../{release-zip.yml => release.yml} | 42 ++++++++++- .gitignore | 4 +- .../ModAssemblyLoadContext.cs | 0 installer/WindowsInstaller.iss | 75 +++++++++++++++++++ 4 files changed, 117 insertions(+), 4 deletions(-) rename .github/workflows/{release-zip.yml => release.yml} (80%) rename StarMap.Core/{ => ModRepository}/ModAssemblyLoadContext.cs (100%) create mode 100644 installer/WindowsInstaller.iss diff --git a/.github/workflows/release-zip.yml b/.github/workflows/release.yml similarity index 80% rename from .github/workflows/release-zip.yml rename to .github/workflows/release.yml index 065fd03..781bd0f 100644 --- a/.github/workflows/release-zip.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Build and Release ZIP +name: Release new version on: pull_request: @@ -6,7 +6,7 @@ on: branches: [main] jobs: - release: + build: if: github.event.pull_request.merged == true runs-on: ubuntu-latest permissions: @@ -18,7 +18,8 @@ jobs: OUTPUT_PATH: ./publish NUGET_SOURCE: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" EXCLUDE: "*.pdb *.xml" - + outputs: + version: ${{ steps.version.outputs.new }} steps: - uses: actions/checkout@v4 with: @@ -147,3 +148,38 @@ jobs: /p:AssemblyVersion=${{ steps.version.outputs.new }} \ /p:FileVersion=${{ steps.version.outputs.new }} dotnet nuget push ./nupkg/*.nupkg --source github --api-key "${{ secrets.GITHUB_TOKEN }}" --skip-duplicate + + - name: Upload publish folder for Windows installer + uses: actions/upload-artifact@v4 + with: + name: publish + path: ${{ env.OUTPUT_PATH }} + + build-installer: + runs-on: windows-latest + needs: build # depends on your main build job + steps: + - uses: actions/checkout@v4 + + # Download the published files from Linux job + - name: Download publish folder + uses: actions/download-artifact@v4 + with: + name: publish + path: publish + + # Install Inno Setup via Chocolatey + - name: Install Inno Setup + run: choco install innosetup --yes + + # Build the installer using the same version as ZIP + - name: Build Inno Setup Installer + run: | + ISCC.exe installer\StarMapInstaller.iss /dAppVersion=${{ needs.build.outputs.version }} /dOutputName=StarMap-${{ needs.build.outputs.version }} + + # Attach installer to the release + - name: Attach installer to GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ needs.build.outputs.version }} + files: installer/dist/StarMap-${{ needs.build.outputs.version }}.exe diff --git a/.gitignore b/.gitignore index 9491a2f..d2223bd 100644 --- a/.gitignore +++ b/.gitignore @@ -360,4 +360,6 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file +FodyWeavers.xsd + +installer/dist diff --git a/StarMap.Core/ModAssemblyLoadContext.cs b/StarMap.Core/ModRepository/ModAssemblyLoadContext.cs similarity index 100% rename from StarMap.Core/ModAssemblyLoadContext.cs rename to StarMap.Core/ModRepository/ModAssemblyLoadContext.cs diff --git a/installer/WindowsInstaller.iss b/installer/WindowsInstaller.iss new file mode 100644 index 0000000..ab4ef41 --- /dev/null +++ b/installer/WindowsInstaller.iss @@ -0,0 +1,75 @@ +[Setup] +AppName=StarMap +AppVersion={#AppVersion} +AppId={{A6C53918-1F1B-4C7B-AF34-63C696A3E822}} +DefaultDirName={pf}\StarMap +DisableDirPage=no +DisableProgramGroupPage=yes +OutputDir=dist +OutputBaseFilename={#OutputName} +Compression=lzma +SolidCompression=yes +Uninstallable=yes + +[Files] +Source: "..\publish\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs + +[Icons] +Name: "{autoprograms}\StarMap"; Filename: "{app}\StarMap.exe" +Name: "{autodesktop}\StarMap"; Filename: "{app}\StarMap.exe"; Tasks: desktopicon + +[Tasks] +Name: "desktopicon"; Description: "Create desktop icon"; Flags: unchecked + +[UninstallDelete] +Type: files; Name: "{app}\StarMapConfig.json" + +[Code] +var + DirPage: TInputDirWizardPage; + SelectedInstallDir: String; + InstallDir: String; + +procedure InitializeWizard; +begin + DirPage := CreateInputDirPage( + wpSelectDir, + 'KSA Install Location', + 'Please select the KSA install location (folder with KSA.dll)', + 'This will be used to launch KSA.', + False, + 'New Folder' + ); + DirPage.Add(''); + DirPage.Values[0] := ''; +end; + +procedure CurStepChanged(CurStep: TSetupStep); +var + ConfigFilePath: String; + JSONText: AnsiString; + SaveOK: Boolean; + ReadBack: AnsiString; + EscapedDir: String; +begin + InstallDir := ExpandConstant('{app}'); + ConfigFilePath := AddBackslash(InstallDir) + 'StarMapConfig.json'; + + if (CurStep = ssPostInstall) and (not FileExists(ConfigFilePath)) then + begin + if (DirPage <> nil) and (DirPage.Values[0] <> '') then + SelectedInstallDir := DirPage.Values[0] + else + SelectedInstallDir := WizardDirValue; + + SelectedInstallDir := ExpandConstant(SelectedInstallDir); + + + + EscapedDir := SelectedInstallDir; + StringChangeEx(EscapedDir, '\', '\\', True); + + JSONText := '{' + '"GameLocation": "' + EscapedDir + '",' + '"RepositoryLocation": ""' + '}'; + SaveOK := SaveStringToFile(ConfigFilePath, JSONText, False); + end; +end; \ No newline at end of file