diff options
| author | rejbasket <39080670+rejbasket@users.noreply.github.com> | 2022-02-28 16:30:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-28 16:30:40 +0100 |
| commit | f2208a88fe4bb4bae20a1f821dd175880c2905d5 (patch) | |
| tree | 85544d2d14a04d34cd7a8e98f0261ee877ca8caf | |
| parent | bd43e007753c1e5baf1f8b191944378beb68c6ec (diff) | |
installer updates (#1565)
* * build zip versions for macOS and windows
* set application version macOS and Windows
* automatically uninstall previous version in Windows
* add zip to upload
Co-authored-by: rejbasket <rejbasket@users.noreply.github.com>
| -rw-r--r-- | .github/workflows/build.yml | 1 | ||||
| -rwxr-xr-x | bin/build-distribution-archives | 7 | ||||
| -rwxr-xr-x | bin/build-electron | 4 | ||||
| -rwxr-xr-x | bin/build-python | 21 | ||||
| -rw-r--r-- | bin/build-windows-installer | 8 | ||||
| -rw-r--r-- | electron/package.json | 2 | ||||
| -rwxr-xr-x | installer_scripts/file_version_info.txt | 40 | ||||
| -rwxr-xr-x | installer_scripts/template.iss | 64 |
8 files changed, 135 insertions, 12 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df568366..e9a0018a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -246,3 +246,4 @@ jobs: artifacts/*.rpm artifacts/*.tar.xz artifacts/*.sh + artifacts/*.zip diff --git a/bin/build-distribution-archives b/bin/build-distribution-archives index 584c0579..d20a9a17 100755 --- a/bin/build-distribution-archives +++ b/bin/build-distribution-archives @@ -1,8 +1,11 @@ VERSION="$(echo ${GITHUB_REF} | sed -e 's|refs/heads/||' -e 's|refs/tags/||' -e 's|/|-|g')" OS="${BUILD:-$(uname)}" mkdir artifacts + if [ "$BUILD" = "osx" ]; then cp -a icons locales print LICENSE VERSION images/examples palettes symbols fonts inx dist/inkstitch.app/Contents/Resources + # adding version to Info.plist + sed -i '' 's/0.0.0/'${VERSION}'/' dist/inkstitch.app/Contents/Info.plist rm -rf dist/inkstitch/ temp_path="/tmp/inkstitch/" # inside the scripts folder are: @@ -68,6 +71,10 @@ if [ "$BUILD" = "osx" ]; then --install-location ${temp_path}inkstitch.app \ artifacts/inkstitch-${VERSION}-${OS}.pkg fi + # Creating the zip for Drag n' Drop install + cd dist + python -m zipfile -c ../artifacts/inkstitch-${VERSION}-${OS}.zip * + cd .. else cp -a images/examples palettes symbols fonts inx LICENSE VERSION dist/inkstitch cp -a icons locales print dist/inkstitch/bin diff --git a/bin/build-electron b/bin/build-electron index f375e347..9fdb88ae 100755 --- a/bin/build-electron +++ b/bin/build-electron @@ -12,6 +12,10 @@ elif [ "$BUILD" = "osx" ]; then args="-m" fi +# electron version setting on release +if [[ "$VERSION" =~ ^v[0-9][.0-9]+$ ]]; then + sed -i'' -e 's/11.99.11/'"${VERSION#v}"'/' electron/package.json +fi cd electron which yarn > /dev/null 2>&1 || npm install -g yarn yarn --link-duplicates --pure-lockfile diff --git a/bin/build-python b/bin/build-python index 5d16cdf8..e84e84a5 100755 --- a/bin/build-python +++ b/bin/build-python @@ -1,7 +1,7 @@ #!/bin/bash set -e - +info_year=$( date "+%Y" ) site_packages="$(python -c "import os; print(os.path.dirname(os.__file__) + '/site-packages')")" if [ "$BUILD" = "linux" ]; then @@ -39,6 +39,7 @@ pyinstaller_args+="--log-level DEBUG " # This adds bundle identifier in reverse DSN format for macos if [ "$BUILD" = "osx" ]; then pyinstaller_args+="--osx-bundle-identifier org.inkstitch.app " + pyinstaller_args+="-i electron/build/icons/mac/inkstitch.icns" if [[ -z ${GITHUB_REF} ]]; then : else @@ -47,6 +48,24 @@ if [ "$BUILD" = "osx" ]; then fi if [ "$BUILD" = "windows" ]; then + if [[ "$VERSION" =~ ^v[0-9][.0-9]+$ ]]; then + # setting the file and product version for release + # Code to remove the periods in the version number + ENT=. + SAL=${VERSION#v}$ENT + INFO_VERSION=() + while [[ $SAL ]]; do + INFO_VERSION+=( "${SAL%%"$ENT"*}" ); + SAL=${SAL#*"$ENT"}; + done; + sed -i'' 's/3, 2, 1,/'"${INFO_VERSION[0]}, ${INFO_VERSION[1]}, ${INFO_VERSION[2]},"'/' installer_scripts/file_version_info.txt + fi + # set year and version in version_info + sed -i'' 's/1.1.1/'"${VERSION#v}"'/' installer_scripts/file_version_info.txt + sed -i'' 's/1234/'"${info_year}"'/' installer_scripts/file_version_info.txt + # sets icon to inkstitch.exe + pyinstaller_args+="--i electron/build/icons/win/inkstitch.ico " + pyinstaller_args+="--version-file installer_scripts/file_version_info.txt " python -m PyInstaller $pyinstaller_args inkstitch.py else # without the LD_LIBRARY_PATH, it seems that pyinstaller can't find all of diff --git a/bin/build-windows-installer b/bin/build-windows-installer index 44c29742..a2d421ce 100644 --- a/bin/build-windows-installer +++ b/bin/build-windows-installer @@ -6,10 +6,16 @@ mkdir win cp installer_scripts/template.iss win/win_build.iss # adds the year and version to the inno installer info_year=$( date "+%Y" ) -copyright_year="#define COPYRIGHT \""${info_year}"\" + URL" +copyright_year="#define COPYRIGHT \""${info_year}"\"" version_block="#define VERSION \""${VERSION}"\"" sed -i'' -e '/;inkstitch-year/ a\'$'\n'"${copyright_year}"'' win/win_build.iss sed -i'' -e '/;inkstitch-version/ a\'$'\n'"${version_block}"'' win/win_build.iss iscc win/win_build.iss mv win/inkstitch.exe artifacts/inkstitch-${VERSION}-${OS}.exe +cd dist +echo "Creating zip" +# The python zipfile command line utility can't handle directories +# containing files with UTF-8 names on Windows, so we use 7-zip instead. +7z a ../artifacts/inkstitch-${VERSION}-${OS}.zip * +cd .. diff --git a/electron/package.json b/electron/package.json index 8d823192..5c905c63 100644 --- a/electron/package.json +++ b/electron/package.json @@ -1,7 +1,7 @@ { "name": "inkstitch-gui", "productName": "inkstitch-gui", - "version": "1.0.0", + "version": "11.99.11", "description": "Ink/Stitch GUI", "main": "./dist/electron/main.js", "scripts": { diff --git a/installer_scripts/file_version_info.txt b/installer_scripts/file_version_info.txt new file mode 100755 index 00000000..4b912e23 --- /dev/null +++ b/installer_scripts/file_version_info.txt @@ -0,0 +1,40 @@ +VSVersionInfo(
+ ffi=FixedFileInfo(
+ # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
+ # Set not needed items to zero 0.
+ filevers=(3, 2, 1, 0),
+ prodvers=(3, 2, 1, 0),
+ # Contains a bitmask that specifies the valid bits 'flags'r
+ mask=0x0,
+ # Contains a bitmask that specifies the Boolean attributes of the file.
+ flags=0x0,
+ # The operating system for which this file was designed.
+ # 0x4 - NT and there is no need to change it.
+ OS=0x40004,
+ # The general type of file.
+ # 0x1 - the file is an application.
+ fileType=0x1,
+ # The function of the file.
+ # 0x0 - the function is not defined for this fileType
+ subtype=0x0,
+ # Creation date and time stamp.
+ date=(0, 0)
+ ),
+ kids=[
+ StringFileInfo(
+ [
+ StringTable(
+ u'040904E4',
+ [StringStruct(u'Comments', u'Published under the GNU GPL'),
+ StringStruct(u'CompanyName', u'Ink/Stitch project'),
+ StringStruct(u'FileDescription', u'An open-source machine embroidery design platform based on Inkscape.'),
+ StringStruct(u'FileVersion', u'1.1.1'),
+ StringStruct(u'InternalName', u'Inkstitch '),
+ StringStruct(u'LegalCopyright', u'© 1234 Inkstitch Open Source Community'),
+ StringStruct(u'OriginalFilename', u'inkstitch.exe'),
+ StringStruct(u'ProductName', u'Inkstitch'),
+ StringStruct(u'ProductVersion', u'1.1.1')])
+ ]),
+ VarFileInfo([VarStruct(u'Translation', [1033, 1252])])
+ ]
+)
diff --git a/installer_scripts/template.iss b/installer_scripts/template.iss index aab1e912..a2654c36 100755 --- a/installer_scripts/template.iss +++ b/installer_scripts/template.iss @@ -32,6 +32,7 @@ VersionInfoCompany={#URL} VersionInfoCopyright=Copyright (C) {#COPYRIGHT}
VersionInfoDescription=An open-source machine embroidery design platform based on Inkscape.
VersionInfoTextVersion={#VERSION}
+VersionInfoVersion=1.0
WizardStyle=modern
ShowLanguageDialog=no
@@ -68,17 +69,62 @@ Name: "English"; Description: "English"; Source: "{#PATHTODIST}\inkstitch\*"; DestDir: "{app}\inkstitch\inkstitch"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Code]
+// SOURCE: https://stackoverflow.com/questions/2000296/inno-setup-how-to-automatically-uninstall-previous-installed-version
+{ ///////////////////////////////////////////////////////////////////// }
+function GetUninstallString(): String;
+var
+ sUnInstPath: String;
+ sUnInstallString: String;
+begin
+ sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
+ sUnInstallString := '';
+ if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
+ RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
+ Result := sUnInstallString;
+end;
+
+
+{ ///////////////////////////////////////////////////////////////////// }
+function IsUpgrade(): Boolean;
+begin
+ Result := (GetUninstallString() <> '');
+end;
+
-function InitializeSetup(): Boolean;
+{ ///////////////////////////////////////////////////////////////////// }
+function UnInstallOldVersion(): Integer;
+var
+ sUnInstallString: String;
+ iResultCode: Integer;
begin
- Result := True;
- if RegKeyExists(HKEY_LOCAL_MACHINE,
- 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppId}_is1') or
- RegKeyExists(HKEY_CURRENT_USER,
- 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#AppId}_is1') then
+{ Return Values: }
+{ 1 - uninstall string is empty }
+{ 2 - error executing the UnInstallString }
+{ 3 - successfully executed the UnInstallString }
+
+ { default return value }
+ Result := 0;
+
+ { get the uninstall string of the old app }
+ sUnInstallString := GetUninstallString();
+ if sUnInstallString <> '' then begin
+ sUnInstallString := RemoveQuotes(sUnInstallString);
+ if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
+ Result := 3
+ else
+ Result := 2;
+ end else
+ Result := 1;
+end;
+
+{ ///////////////////////////////////////////////////////////////////// }
+procedure CurStepChanged(CurStep: TSetupStep);
+begin
+ if (CurStep=ssInstall) then
begin
- MsgBox('The application is installed already.', mbInformation, MB_OK);
- Result := False;
+ if (IsUpgrade()) then
+ begin
+ UnInstallOldVersion();
+ end;
end;
end;
-
|
