diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df5683660..e9a0018aa 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 584c05790..d20a9a173 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 f375e347e..9fdb88ae9 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 5d16cdf83..e84e84a52 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 44c297424..a2d421ce5 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 8d823192b..5c905c637 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 000000000..4b912e239 --- /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 aab1e9120..a2654c364 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] - -function InitializeSetup(): Boolean; +// SOURCE: https://stackoverflow.com/questions/2000296/inno-setup-how-to-automatically-uninstall-previous-installed-version +{ ///////////////////////////////////////////////////////////////////// } +function GetUninstallString(): String; +var + sUnInstPath: String; + sUnInstallString: String; 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 - begin - MsgBox('The application is installed already.', mbInformation, MB_OK); - Result := False; - end; + 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 UnInstallOldVersion(): Integer; +var + sUnInstallString: String; + iResultCode: Integer; +begin +{ 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 + if (IsUpgrade()) then + begin + UnInstallOldVersion(); + end; + end; +end;