From a2d7f3b5bba68d551d8f5ae2b905303c7ce5a46a Mon Sep 17 00:00:00 2001 From: hstyi Date: Mon, 24 Feb 2025 00:46:45 +0800 Subject: [PATCH] chore: Inno Setup --- .github/workflows/osx-aarch64.yml | 2 +- .github/workflows/osx-x86-64.yml | 2 +- .github/workflows/windows-x86-64.yml | 2 +- build.gradle.kts | 14 ++++--- src/main/resources/termora.iss | 61 ++++++++++++++++++++++++++++ 5 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/termora.iss diff --git a/.github/workflows/osx-aarch64.yml b/.github/workflows/osx-aarch64.yml index 92fc65a..2d8ea61 100644 --- a/.github/workflows/osx-aarch64.yml +++ b/.github/workflows/osx-aarch64.yml @@ -67,7 +67,7 @@ jobs: # dist - name: Dist env: - TERMORA_MAC_SIGN: ${{ github.event_name == 'push' }} + TERMORA_MAC_SIGN: ${{ github.event_name == 'push' && github.repository == 'TermoraDev/termora' }} TERMORA_MAC_SIGN_USER_NAME: ${{ secrets.TERMORA_MAC_SIGN_USER_NAME }} # 只有发布版本时才需要公证 TERMORA_MAC_NOTARY: ${{ github.ref_type == 'tag' && github.repository == 'TermoraDev/termora' }} diff --git a/.github/workflows/osx-x86-64.yml b/.github/workflows/osx-x86-64.yml index 0d073a8..f1a4560 100644 --- a/.github/workflows/osx-x86-64.yml +++ b/.github/workflows/osx-x86-64.yml @@ -69,7 +69,7 @@ jobs: # dist - name: Dist env: - TERMORA_MAC_SIGN: ${{ github.event_name == 'push' }} + TERMORA_MAC_SIGN: ${{ github.event_name == 'push' && github.repository == 'TermoraDev/termora' }} TERMORA_MAC_SIGN_USER_NAME: ${{ secrets.TERMORA_MAC_SIGN_USER_NAME }} # 只有发布版本时才需要公证 TERMORA_MAC_NOTARY: ${{ github.ref_type == 'tag' && github.repository == 'TermoraDev/termora' }} diff --git a/.github/workflows/windows-x86-64.yml b/.github/workflows/windows-x86-64.yml index ebf9a99..2a221fb 100644 --- a/.github/workflows/windows-x86-64.yml +++ b/.github/workflows/windows-x86-64.yml @@ -46,4 +46,4 @@ jobs: path: | build/distributions/*.zip build/distributions/*.msi - build/distributions/*.7z + build/distributions/*.exe diff --git a/build.gradle.kts b/build.gradle.kts index 095b932..a6d0676 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -522,14 +522,18 @@ fun packOnWindows(distributionDir: Directory, finalFilenameWithoutExtension: Str workingDir = layout.buildDirectory.dir("jpackage/images/win-msi.image/").get().asFile } - // 7z + // exe exec { commandLine( - "7z", "a", "-mx=9", "-m0=lzma2", "-mmt=on", "-bso0", - distributionDir.file("${finalFilenameWithoutExtension}.7z").asFile.absolutePath, - projectName + "iscc", + "/DMyAppName=${projectName}", + "/DMyAppVersion=${project.version}", + "/DMyOutputDir=${distributionDir.asFile.absolutePath}", + "/DMySetupIconFile=${FileUtils.getFile(projectDir, "src", "main", "resources", "icons", "termora.ico")}", + "/DMySourceDir=${layout.buildDirectory.dir("jpackage/images/win-msi.image/${projectName}").get().asFile}", + "/F${finalFilenameWithoutExtension}", + FileUtils.getFile(projectDir, "src", "main", "resources", "termora.iss") ) - workingDir = layout.buildDirectory.dir("jpackage/images/win-msi.image/").get().asFile } // msi diff --git a/src/main/resources/termora.iss b/src/main/resources/termora.iss new file mode 100644 index 0000000..e096b10 --- /dev/null +++ b/src/main/resources/termora.iss @@ -0,0 +1,61 @@ +; Script generated by the Inno Setup Script Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +#define MyAppId "14F2657D-1B3F-4EA1-A1AA-AB6B5E4FD465" +#define MyAppPublisher "TermoraDev" +#define MyAppURL "https://github.com/TermoraDev/termora" +#define MyAppSupportURL "https://github.com/TermoraDev/termora/issues" +#define MyAppUpdatesURL "https://github.com/TermoraDev/termora/releases" +#define MyAppExeName "Termora.exe" + + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) +AppId={{{#MyAppId}} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppSupportURL} +AppUpdatesURL={#MyAppUpdatesURL} +DefaultDirName={autopf}\{#MyAppName} +UninstallDisplayIcon={app}\{#MyAppExeName} +; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run +; on anything but x64 and Windows 11 on Arm. +ArchitecturesAllowed=x64compatible +; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the +; install be done in "64-bit mode" on x64 or Windows 11 on Arm, +; meaning it should use the native 64-bit Program Files directory and +; the 64-bit view of the registry. +ArchitecturesInstallIn64BitMode=x64compatible +DisableProgramGroupPage=yes +; Uncomment the following line to run in non administrative install mode (install for current user only). +;PrivilegesRequired=lowest +OutputDir={#MyOutputDir} +OutputBaseFilename={#MyAppName}-{#MyAppVersion} +SolidCompression=yes +WizardStyle=classic +;WizardStyle=modern +SetupIconFile={#MySetupIconFile} +;WizardSmallImageFile= + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked + +[Files] +Source: "{#MySourceDir}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#MySourceDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Icons] +Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" +Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon + +[Run] +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent +