Fixed paths for the dmg_sign_notarize script

Contributes to CURA-9365
This commit is contained in:
jellespijker 2022-07-06 10:50:01 +02:00
parent 13d5d33ec8
commit 4344ef066f
3 changed files with 17 additions and 21 deletions

View File

@ -186,11 +186,8 @@ jobs:
- name: Create the MacOS dmg (Bash) - name: Create the MacOS dmg (Bash)
if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }} if: ${{ github.event.inputs.installer == 'true' && runner.os == 'Macos' }}
run: python ../cura_inst/packaging/dmg/dmg_sign_noterize.py "Ultimaker-Cura-$CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.dmg" run: python ../cura_inst/packaging/dmg/dmg_sign_noterize.py ../cura_inst . "Ultimaker-Cura-$CURA_VERSION_FULL-${{ runner.os }}-${{ runner.arch }}.dmg"
working-directory: dist working-directory: dist
env:
SOURCE_DIR: ${{ env.GITHUB_WORKSPACE }}/cura_inst
DIST_DIR: ${{ env.GITHUB_WORKSPACE }}/dist
- name: Upload the artifacts - name: Upload the artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -2,31 +2,28 @@ import os
import argparse # Command line arguments parsing and help. import argparse # Command line arguments parsing and help.
import subprocess import subprocess
SOURCE_DIR = os.environ.get("SOURCE_DIR", ".")
DIST_DIR = os.environ.get("DIST_DIR", os.path.join(SOURCE_DIR, "dist"))
APP_PATH = os.path.join(DIST_DIR, "Ultimaker-Cura.app")
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(filename: str) -> None: def build_dmg(source_path: str, dist_path: str, filename: str) -> None:
create_dmg_executable = os.environ.get("CREATE_DMG_EXECUTABLE", "create-dmg") create_dmg_executable = os.environ.get("CREATE_DMG_EXECUTABLE", "create-dmg")
arguments = [create_dmg_executable, arguments = [create_dmg_executable,
"--window-pos", "640", "360", "--window-pos", "640", "360",
"--window-size", "690", "503", "--window-size", "690", "503",
"--app-drop-link", "520", "272", "--app-drop-link", "520", "272",
"--volicon", f"{SOURCE_DIR}/packaging/icons/VolumeIcons_Cura.icns", "--volicon", f"{source_path}/packaging/icons/VolumeIcons_Cura.icns",
"--icon-size", "90", "--icon-size", "90",
"--icon", "Ultimaker-Cura.app", "169", "272", "--icon", "Ultimaker-Cura.app", "169", "272",
"--eula", f"{SOURCE_DIR}/packaging/cura_license.txt", "--eula", f"{source_path}/packaging/cura_license.txt",
"--background", f"{SOURCE_DIR}/packaging/icons/cura_background_dmg.png", "--background", f"{source_path}/packaging/dmg/cura_background_dmg.png",
filename, f"{dist_path}/{filename}",
APP_PATH] f"{dist_path}/Ultimaker-Cura.app"]
subprocess.run(arguments) subprocess.run(arguments)
def sign(filename: str) -> None: def sign(dist_path: str, filename: str) -> None:
codesign_executable = os.environ.get("CODESIGN", "codesign") codesign_executable = os.environ.get("CODESIGN", "codesign")
codesign_identity = os.environ.get("CODESIGN_IDENTITY") codesign_identity = os.environ.get("CODESIGN_IDENTITY")
@ -34,12 +31,12 @@ def sign(filename: str) -> None:
"-s", codesign_identity, "-s", codesign_identity,
"--timestamp", "--timestamp",
"-i", f"{ULTIMAKER_CURA_DOMAIN}.dmg", # TODO: check if this really should have the extra dmg. We seem to be doing this also in the old Rundeck scripts "-i", f"{ULTIMAKER_CURA_DOMAIN}.dmg", # TODO: check if this really should have the extra dmg. We seem to be doing this also in the old Rundeck scripts
filename] f"{dist_path}/{filename}"]
subprocess.run(arguments) subprocess.run(arguments)
def notarize(filename: str) -> None: def notarize(dist_path: str, filename: str) -> None:
notarize_user = os.environ.get("MAC_NOTARIZE_USER") notarize_user = os.environ.get("MAC_NOTARIZE_USER")
notarize_password = os.environ.get("MAC_NOTARIZE_PASSWORD") notarize_password = os.environ.get("MAC_NOTARIZE_PASSWORD")
altool_executable = os.environ.get("ALTOOL_EXECUTABLE", "altool") altool_executable = os.environ.get("ALTOOL_EXECUTABLE", "altool")
@ -50,19 +47,21 @@ def notarize(filename: str) -> None:
"--primary-bundle-id", ULTIMAKER_CURA_DOMAIN, "--primary-bundle-id", ULTIMAKER_CURA_DOMAIN,
"--username", notarize_user, "--username", notarize_user,
"--password", notarize_password, "--password", notarize_password,
"--file", filename "--file", f"{dist_path}/{filename}"
] ]
subprocess.run(arguments) subprocess.run(arguments)
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description = "Create AppImages of Cura.") parser = argparse.ArgumentParser(description = "Create dmg of Cura.")
parser.add_argument("source_path", type=str, help="Path to Conan install Cura folder.")
parser.add_argument("dist_path", type=str, help="Path to Pyinstaller dist folder")
parser.add_argument("filename", type = str, help = "Filename of the dmg (e.g. 'Ultimaker-Cura-5.1.0-beta-Linux-X64.dmg')") parser.add_argument("filename", type = str, help = "Filename of the dmg (e.g. 'Ultimaker-Cura-5.1.0-beta-Linux-X64.dmg')")
args = parser.parse_args() args = parser.parse_args()
build_dmg(args.filename) build_dmg(args.source_path, args.dist_path, args.filename)
sign(args.filename) sign(args.dist_path, args.filename)
notarize_dmg = bool(os.environ.get("NOTARIZE_DMG", "TRUE")) notarize_dmg = bool(os.environ.get("NOTARIZE_DMG", "TRUE"))
if notarize_dmg: if notarize_dmg:
notarize(args.filename) notarize(args.dist_path, args.filename)