Revert dmg deprecation

CURA-6867
This commit is contained in:
Joey de l'Arago 2023-01-12 13:24:28 +01:00
parent ca34fe2d2d
commit 05e1f57324
3 changed files with 74 additions and 7 deletions

View file

@ -1,5 +1,5 @@
name: Cura All Installers name: Cura All Installers
run-name: ${{ inputs.cura_conan_version }} for exe ${{ inputs.build_windows_exe }}, msi ${{ inputs.build_windows_msi }}, dmg ${{ inputs.build_macos }}, appimage ${{ inputs.build_linux }} - enterprise ${{ inputs.enterprise }} run-name: ${{ inputs.cura_conan_version }} for exe ${{ inputs.build_windows_exe }}, msi ${{ inputs.build_windows_msi }}, dmg ${{ inputs.build_macos }}, pkg ${{ inputs.build_macos_installer }}, appimage ${{ inputs.build_linux }} - enterprise ${{ inputs.enterprise }}
on: on:
workflow_dispatch: workflow_dispatch:
@ -50,7 +50,12 @@ on:
required: true required: true
type: boolean type: boolean
build_macos: build_macos:
description: 'Build for MacOS' description: 'Build dmg for MacOS'
default: true
required: true
type: boolean
build_macos_installer:
description: 'Build pkg for MacOS'
default: true default: true
required: true required: true
type: boolean type: boolean
@ -120,7 +125,7 @@ jobs:
msi_installer: false msi_installer: false
secrets: inherit secrets: inherit
macos-installer-create: macos-dmg-create:
if: ${{ inputs.build_macos }} if: ${{ inputs.build_macos }}
uses: ./.github/workflows/cura-installer.yml uses: ./.github/workflows/cura-installer.yml
with: with:
@ -134,3 +139,19 @@ jobs:
installer: ${{ inputs.installer }} installer: ${{ inputs.installer }}
msi_installer: false msi_installer: false
secrets: inherit secrets: inherit
macos-installer-create:
if: ${{ inputs.build_macos }}
uses: ./.github/workflows/cura-installer.yml
with:
platform: 'macos-11'
os_name: 'mac'
cura_conan_version: ${{ inputs.cura_conan_version }}
conan_args: ${{ inputs.conan_args }}
conan_config: ${{ inputs.conan_config }}
enterprise: ${{ inputs.enterprise }}
staging: ${{ inputs.staging }}
installer: ${{ inputs.installer }}
msi_installer: false
pkg_installer: true
secrets: inherit

View file

@ -49,6 +49,11 @@ on:
default: false default: false
required: true required: true
type: boolean type: boolean
pkg_installer:
description: 'Create the pkg'
default: false
required: true
type: boolean
env: env:
CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }} CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
@ -120,7 +125,7 @@ jobs:
- name: Install MacOS system requirements - name: Install MacOS system requirements
if: ${{ runner.os == 'Macos' }} if: ${{ runner.os == 'Macos' }}
run: brew install autoconf automake ninja run: brew install autoconf automake ninja create-dmg
- name: Install Linux system requirements - name: Install Linux system requirements
if: ${{ runner.os == 'Linux' }} if: ${{ runner.os == 'Linux' }}
@ -251,7 +256,7 @@ jobs:
if "${{ runner.os }}" == "Windows": if "${{ runner.os }}" == "Windows":
installer_ext = "msi" if "${{ inputs.msi_installer }}" == "true" else "exe" installer_ext = "msi" if "${{ inputs.msi_installer }}" == "true" else "exe"
elif "${{ runner.os }}" == "macOS": elif "${{ runner.os }}" == "macOS":
installer_ext = "pkg" installer_ext = "pkg" if "${{ inputs.pkg_installer }}" == "true" else "dmg"
else: else:
installer_ext = "AppImage" installer_ext = "AppImage"
output_env = os.environ["GITHUB_OUTPUT"] output_env = os.environ["GITHUB_OUTPUT"]
@ -308,7 +313,7 @@ jobs:
run: python ../cura_inst/packaging/AppImage/create_appimage.py ./UltiMaker-Cura $CURA_VERSION_FULL "${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }}" run: python ../cura_inst/packaging/AppImage/create_appimage.py ./UltiMaker-Cura $CURA_VERSION_FULL "${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }}"
working-directory: dist working-directory: dist
- name: Create the MacOS pkg (Bash) - name: Create the MacOS dmg and/or pkg (Bash)
if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }} if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }}
run: python ../cura_inst/packaging/MacOS/build_macos.py . "${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }}" run: python ../cura_inst/packaging/MacOS/build_macos.py . "${{ steps.filename.outputs.FULL_INSTALLER_FILENAME }}"
working-directory: dist working-directory: dist

View file

@ -9,6 +9,24 @@ from pathlib import Path
ULTIMAKER_CURA_DOMAIN = os.environ.get("ULTIMAKER_CURA_DOMAIN", "nl.ultimaker.cura") ULTIMAKER_CURA_DOMAIN = os.environ.get("ULTIMAKER_CURA_DOMAIN", "nl.ultimaker.cura")
def build_dmg(source_path: str, dist_path: str, filename: str) -> None:
create_dmg_executable = os.environ.get("CREATE_DMG_EXECUTABLE", "create-dmg")
arguments = [create_dmg_executable,
"--window-pos", "640", "360",
"--window-size", "690", "503",
"--app-drop-link", "520", "272",
"--volicon", f"{source_path}/packaging/icons/VolumeIcons_Cura.icns",
"--icon-size", "90",
"--icon", "UltiMaker-Cura.app", "169", "272",
"--eula", f"{source_path}/packaging/cura_license.txt",
"--background", f"{source_path}/packaging/MacOs/cura_background_dmg.png",
f"{dist_path}/{filename}",
f"{dist_path}/UltiMaker-Cura.app"]
subprocess.run(arguments)
def build_pkg(dist_path: str, app_filename: str, component_filename: str, installer_filename: str) -> None: def build_pkg(dist_path: str, app_filename: str, component_filename: str, installer_filename: str) -> None:
""" Builds and signs the pkg installer. """ Builds and signs the pkg installer.
@ -102,10 +120,33 @@ def create_pkg_installer(filename: str, dist_path: str) -> None:
if notarize: if notarize:
notarize_file(dist_path, filename) notarize_file(dist_path, filename)
def create_dmg(filename: str, dist_path: str, source_path: str) -> None:
""" Creates a dmg executable from UltiMaker-Cura.app named {filename}.dmg
@param filename: The name of the app file and the output dmg file without the extension
@param dist_path: The location to read the app from and save the dmg to
@param source_path: The location of the project source files
"""
dmg_filename = f"{filename}.dmg"
build_dmg(source_path, dist_path, dmg_filename)
notarize_dmg = bool(os.environ.get("NOTARIZE_DMG", "TRUE"))
if notarize_dmg:
notarize_file(dist_path, dmg_filename)
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description = "Create installer for Cura.") parser = argparse.ArgumentParser(description = "Create installer for Cura.")
parser.add_argument("dist_path", type = str, help="Path to Pyinstaller dist folder") parser.add_argument("dist_path", type = str, help="Path to Pyinstaller dist folder")
parser.add_argument("filename", type = str, help = "Filename of the pkg (e.g. 'UltiMaker-Cura-5.1.0-beta-Macos-X64.pkg')") parser.add_argument("filename", type = str, help = "Filename of the pkg (e.g. 'UltiMaker-Cura-5.1.0-beta-Macos-X64.pkg')")
args = parser.parse_args() args = parser.parse_args()
create_pkg_installer(args.filename, args.dist_path) if Path(args.filename).suffix == ".pkg":
create_pkg_installer(args.filename, args.dist_path)
elif Path(args.filename).suffix == ".dmg":
create_dmg(args.filename, args.dist_path, args.source_path)
else:
create_dmg(args.filename, args.dist_path, args.source_path)