diff --git a/.github/workflows/cura-installer.yml b/.github/workflows/cura-installer.yml index a78d1c2c0e..69ffddfd30 100644 --- a/.github/workflows/cura-installer.yml +++ b/.github/workflows/cura-installer.yml @@ -41,8 +41,13 @@ env: CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }} CONAN_NON_INTERACTIVE: 1 CODESIGN_IDENTITY: ${{ secrets.CODESIGN_IDENTITY }} - NOTARIZE_USER: ${{ secrets.NOTARIZE_USER }} - NOTARIZE_PASSWORD: ${{ secrets.NOTARIZE_PASSWORD }} + MAC_NOTARIZE_USER: ${{ secrets.MAC_NOTARIZE_USER }} + MAC_NOTARIZE_PASS: ${{ secrets.MAC_NOTARIZE_PASS }} + MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }} + MACOS_CERT_PASS: ${{ secrets.MACOS_CERT_PASS }} + MACOS_CERT_USER: ${{ secrets.MACOS_CERT_USER }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + MACOS_CERT_PASSPHRASE: ${{ secrets.$MACOS_CERT_PASSPHRASE }} jobs: cura-installer-create: @@ -60,7 +65,7 @@ jobs: - name: Setup Python and pip uses: actions/setup-python@v4 with: - python-version: '3.10.4' + python-version: '3.10.x' cache: 'pip' cache-dependency-path: .github/workflows/requirements-conan-package.txt @@ -102,7 +107,23 @@ jobs: - name: Install Linux system requirements if: ${{ runner.os == 'Linux' }} - run: sudo apt install build-essential checkinstall zlib1g-dev libssl-dev ninja-build autoconf libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev -y + run: | + sudo apt install build-essential checkinstall zlib1g-dev libssl-dev ninja-build autoconf libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev -y + wget --no-check-certificate --quiet https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O $GITHUB_WORKSPACE/appimagetool + chmod +x $GITHUB_WORKSPACE/appimagetool + echo "APPIMAGETOOL_LOCATION=$GITHUB_WORKSPACE/appimagetool" >> $GITHUB_ENV + + - name: Configure GPG Key Linux (Bash) + if: ${{ runner.os == 'Linux' }} + run: echo -n "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import + + - name: Configure Macos keychain (Bash) + if: ${{ runner.os == 'Macos' }} + run: | + CERTIFICATE_PATH=$RUNNER_TEMP/um_keychain.p12 + echo -n "$MACOS_CERT_P12" | base64 --decode --output $CERTIFICATE_PATH + security import $CERTIFICATE_PATH -p $MACOS_CERT_PASSPHRASE -A + security unlock -p $MACOS_CERT_USER $CERTIFICATE_PATH - name: Clean Conan local cache if: ${{ inputs.conan_clean_local_cache }} @@ -119,45 +140,70 @@ jobs: - name: Create the Packages run: conan install ${{ inputs.cura_conan_version }} --build=missing --update -c tools.env.virtualenv:powershell=True -if cura_inst -g VirtualPythonEnv -o cura:enterprise=${{ inputs.enterprise }} -o cura:staging=${{ inputs.staging }} - - name: Upload the Package(s) - if: always() - run: | - conan upload "*" -r cura --all -c - conan upload "*" -r cura-ce -c - - name: Set Environment variables for Cura (bash) if: ${{ runner.os != 'Windows' }} - run: . ./cura_inst/bin/activate_github_actions_env.sh + run: | + . ./cura_inst/bin/activate_github_actions_env.sh + . ./cura_inst/bin/activate_github_actions_version_env.sh - name: Set Environment variables for Cura (Powershell) if: ${{ runner.os == 'Windows' }} - run: .\cura_inst\Scripts\activate_github_actions_env.ps1 + run: | + .\cura_inst\Scripts\activate_github_actions_env.ps1 + .\cura_inst\Scripts\activate_github_actions_version_env.ps1 - name: Create the Cura dist run: pyinstaller ./cura_inst/Ultimaker-Cura.spec - name: Archive the artifacts (bash) if: ${{ github.event.inputs.installer == 'false' && runner.os != 'Windows' }} - run: tar -zcf "./Ultimaker-Cura-${{ needs.get-semver.outputs.semver_full }}-${{ runner.os }}-${{ runner.arch }}.tar.gz" "./Ultimaker-Cura/" + run: tar -zcf "./Ultimaker-Cura-$CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.tar.gz" "./Ultimaker-Cura/" working-directory: dist - name: Archive the artifacts (Powershell) if: ${{ github.event.inputs.installer == 'false' && runner.os == 'Windows' }} - run: Compress-Archive -Path ".\Ultimaker-Cura" -DestinationPath ".\Ultimaker-Cura-${{ needs.get-semver.outputs.semver_full }}-${{ runner.os }}-${{ runner.arch }}.zip" + run: Compress-Archive -Path ".\Ultimaker-Cura" -DestinationPath ".\Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.zip" working-directory: dist -# FIXME: When the NSIS resources and scripts are to Cura repo and packaged -# - name: Create the Windows exe installer (Powershell) -# if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Windows' }} -# run: | -# python "$Env:GITHUB_WORKSPACE\packaging\NSIS\nsis-configurator.py" um_path "$Env:GITHUB_WORKSPACE\packaging\NSIS\Ultimaker-Cura.nsi.jinja" "Ultimaker Cura" "Ultimaker-Cura.exe" "${{ needs.get-semver.outputs.semver_major }}" "${{ needs.get-semver.outputs.semver_minor }}" "${{ needs.get-semver.outputs.semver_patch }}" "0" "Ultimaker B.V." "https://ultimaker.com" "$Env:GITHUB_WORKSPACE\packaging\cura_license.txt" "LZMA" "$Env:GITHUB_WORKSPACE\packaging\cura_banner_nsis.bmp" "$Env:GITHUB_WORKSPACE\packaging\Cura.ico" "Ultimaker-Cura-${{ needs.get-semver.outputs.semver_full }}-${{ runner.os }}-${{ runner.arch }}.exe" -# makensis /V2 /P4 Ultimaker-Cura.nsi -# working-directory: dist + - name: Create the Windows exe installer (Powershell) + if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Windows' }} + run: | + python ..\cura_inst\packaging\NSIS\nsis-configurator.py ".\Ultimaker-Cura" "..\cura_inst\packaging\NSIS\Ultimaker-Cura.nsi.jinja" "Ultimaker Cura" "Ultimaker-Cura.exe" "$Env:CURA_VERSION_MAJOR" "$Env:CURA_VERSION_MINOR" "$Env:CURA_VERSION_PATCH" "$Env:CURA_VERSION_BUILD" "Ultimaker B.V." "https://ultimaker.com" "..\cura_inst\packaging\cura_license.txt" "LZMA" "..\cura_inst\packaging\NSIS\cura_banner_nsis.bmp" "..\cura_inst\packaging\icons\Cura.ico" "Ultimaker-Cura-$Env:CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.exe" + makensis /V2 /P4 Ultimaker-Cura.nsi + working-directory: dist + + - name: Create the Linux AppImage (Bash) + if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Linux' }} + run: python ../cura_inst/packaging/AppImage/create_appimage.py ./Ultimaker-Cura $CURA_VERSION_FULL + working-directory: dist + + - name: Create the MacOS dmg (Bash) alternative + if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }} + run: create-dmg --window-pos 640 360 --volicon "../cura_inst/packaging/icons/VolumeIcons_Cura.icns" --window-size 690 503 --icon-size 90 --icon "Ultimaker-Cura.app" 169 272 --app-drop-link 520 272 --eula "../cura_inst/packaging/cura_license.txt" --background "../cura_inst/packaging/icons/cura_background_dmg.png" --rez Rez "./Ultimaker-Cura.dmg" "./Ultimaker-Cura.app" + working-directory: dist + + - name: Sign the MacOS dmg (Bash) alternative + if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }} + run: codesign -s "$CODESIGN_IDENTITY" --timestamp -i "nl.ultimaker.cura.dmg" "./Ultimaker-Cura.dmg" + working-directory: dist + + - name: Notarize the MacOS dmg (Bash) alternative + if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }} + run: xcrun altool --notarize-app --primary-bundle-id "nl.ultimaker.cura" --username "$MAC_NOTARIZE_USER" --password "$MAC_NOTARIZE_PASS" --file "./Ultimaker-Cura.dmg" + working-directory: dist + + - name: Create the MacOS dmg (Bash) + if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }} + run: python ../cura_inst/packaging/dmg/dmg_sign_notarize.py + working-directory: dist + env: + SOURCE_DIR: ${{ env.GITHUB_WORKSPACE }}/cura_inst + DIST_DIR: ${{ env.GITHUB_WORKSPACE }}/dist - name: Upload the artifacts uses: actions/upload-artifact@v3 with: - name: Ultimaker-Cura-${{ needs.get-semver.outputs.semver_full }}-${{ runner.os }}-${{ runner.arch }} + name: Ultimaker-Cura-${{ env.CURA_VERSION_FULL }}-${{ runner.os }}-${{ runner.arch }} path: | dist/*.tar.gz dist/*.zip @@ -165,4 +211,5 @@ jobs: dist/*.msi dist/*.dmg dist/*.AppImage + dist/*.asc retention-days: 2