From 96df68c46f495de0f63d36b5130e7dfdc773198a Mon Sep 17 00:00:00 2001 From: rejbasket <39080670+rejbasket@users.noreply.github.com> Date: Sun, 30 Jul 2023 16:01:43 +0200 Subject: [PATCH] add windows 64bit version (#2413) * test build for windows 64bit * testing build for windows 64bit * fixed arch check for windows file name added electron 64bit for windows * blocked 64bit installer to be installed in 32bit windows --------- Co-authored-by: rejbasket --- .github/workflows/build.yml | 63 +++++++++++++++++++++++++++++++--- bin/build-electron | 7 +++- bin/build-windows-installer | 13 +++++-- installer_scripts/template.iss | 2 +- 4 files changed, 76 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec4864ec2..3a0a50b19 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -90,7 +90,7 @@ jobs: with: name: inkstitch-linux path: artifacts - windows: + windows32: runs-on: windows-latest steps: - uses: actions/checkout@v3 @@ -141,7 +141,54 @@ jobs: folder: 'artifacts' - uses: actions/upload-artifact@v3 with: - name: inkstitch-windows + name: inkstitch-windows32 + path: artifacts + windows64: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - uses: actions/setup-node@v3 + with: + node-version: '16.x' + - uses: actions/setup-python@v4 + with: + python-version: '3.8.x' + architecture: 'x64' + - uses: microsoft/setup-msbuild@v1.3.1 + - name: install dependencies + shell: bash + run: | + git config --system core.longpaths true + python -m pip install --upgrade pip + python -m pip install wheel + python -m pip install -r requirements.txt + python -m pip install pyinstaller + + echo "${{ env.pythonLocation }}\bin" >> $GITHUB_PATH + - shell: bash + run: | + make dist + env: + BUILD: windows + - uses: dlemstra/code-sign-action@v1 + with: + certificate: '${{ secrets.INKSTITCH_CODE_SIGNING_CERTIFICATE }}' + folder: 'dist' + recursive: true + - shell: bash + run: | + bash bin/build-windows-installer + env: + BUILD: windows + - uses: dlemstra/code-sign-action@v1 + with: + certificate: '${{ secrets.INKSTITCH_CODE_SIGNING_CERTIFICATE }}' + folder: 'artifacts' + - uses: actions/upload-artifact@v3 + with: + name: inkstitch-windows64 path: artifacts mac: runs-on: macos-11 @@ -204,7 +251,7 @@ jobs: release: runs-on: ubuntu-latest - needs: [linux, windows, mac] + needs: [linux, windows32, windows64, mac] if: always() steps: - name: determine release info @@ -227,10 +274,16 @@ jobs: with: name: 'inkstitch-linux' path: 'artifacts/' - - name: download windows + - name: download windows32 uses: actions/download-artifact@v3 with: - name: 'inkstitch-windows' + name: 'inkstitch-windows32' + path: 'artifacts/' + if: always() + - name: download windows64 + uses: actions/download-artifact@v3 + with: + name: 'inkstitch-windows64' path: 'artifacts/' if: always() - name: download mac diff --git a/bin/build-electron b/bin/build-electron index cdc98f9d3..51bb7de43 100755 --- a/bin/build-electron +++ b/bin/build-electron @@ -1,10 +1,15 @@ #!/bin/bash +ARCH=$(python -c "import platform; n = platform.architecture()[0]; print(n)") set -e set -x if [ "$BUILD" = "windows" ]; then - args="-w --ia32" + if [ "$ARCH" = "32bit" ]; then + args="-w --ia32" + else + args="-w --x64" + fi elif [ "$BUILD" = "linux" ]; then args="-l" elif [ "$BUILD" = "osx" ]; then diff --git a/bin/build-windows-installer b/bin/build-windows-installer index 90f72d711..bf7b8288f 100755 --- a/bin/build-windows-installer +++ b/bin/build-windows-installer @@ -1,6 +1,7 @@ #!/bin/bash VERSION="${VERSION:-$(echo ${GITHUB_REF} | sed -e 's|refs/heads/||' -e 's|refs/tags/||' -e 's|/|-|g')}" OS="${BUILD:-$(uname)}" +ARCH=$(python -c "import platform; n = platform.architecture()[0]; print(n)") # Create windows installer mkdir win cp installer_scripts/template.iss win/win_build.iss @@ -10,12 +11,20 @@ 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 +# set installer to stop 64bit version to be installed in 32bit Windows +if [[ ${ARCH} == "64bit" ]]; then + echo "64" + sed -i'' -e '/;arch-allowed/ a\'$'\n'"ArchitecturesAllowed=x64 arm64"'' win/win_build.iss +else + echo "32" + sed -i'' -e '/;arch-allowed/ a\'$'\n'"ArchitecturesAllowed=x86 x64 arm64"'' win/win_build.iss +fi iscc win/win_build.iss -mv win/inkstitch.exe artifacts/inkstitch-${VERSION}-${OS}.exe +mv win/inkstitch.exe artifacts/inkstitch-${VERSION}-${OS}-${ARCH}.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 * +7z a ../artifacts/inkstitch-${VERSION}-${OS}-${ARCH}.zip * cd .. diff --git a/installer_scripts/template.iss b/installer_scripts/template.iss index 0dc18041f..99ae6d33d 100755 --- a/installer_scripts/template.iss +++ b/installer_scripts/template.iss @@ -23,9 +23,9 @@ AppUpdatesURL={#URL} DefaultDirName={userappdata}\inkscape\extensions\ DefaultGroupName={#PROGRAMNAME} ; Remove the following line to run in administrative install mode (install for all users.) -ArchitecturesAllowed=x64 x86 arm64 PrivilegesRequired=lowest OutputBaseFilename=inkstitch +;arch-allowed OutputDir=. Compression=lzma SolidCompression=yes