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>
pull/1618/head
rejbasket 2022-02-28 16:30:40 +01:00 zatwierdzone przez GitHub
rodzic bd43e00775
commit f2208a88fe
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
8 zmienionych plików z 137 dodań i 14 usunięć

Wyświetl plik

@ -246,3 +246,4 @@ jobs:
artifacts/*.rpm
artifacts/*.tar.xz
artifacts/*.sh
artifacts/*.zip

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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 ..

Wyświetl plik

@ -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": {

Wyświetl plik

@ -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])])
]
)

Wyświetl plik

@ -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;