cura/latest@ultimaker/cura_11288 for Windows-X64 by @casperlamboo #109
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows Installer | |
run-name: ${{ inputs.cura_conan_version }} for Windows-${{ inputs.architecture }} by @${{ github.actor }} | |
on: | |
workflow_dispatch: | |
inputs: | |
cura_conan_version: | |
description: 'Cura Conan Version' | |
default: 'cura/latest@ultimaker/testing' | |
required: true | |
type: string | |
conan_args: | |
description: 'Conan args: eq.: --require-override' | |
default: '' | |
required: false | |
type: string | |
enterprise: | |
description: 'Build Cura as an Enterprise edition' | |
default: false | |
required: true | |
type: boolean | |
staging: | |
description: 'Use staging API' | |
default: false | |
required: true | |
type: boolean | |
architecture: | |
description: 'Architecture' | |
required: true | |
default: 'X64' | |
type: choice | |
options: | |
- X64 | |
operating_system: | |
description: 'OS' | |
required: true | |
default: 'windows-2022' | |
type: choice | |
options: | |
- windows-2022 | |
workflow_call: | |
inputs: | |
cura_conan_version: | |
description: 'Cura Conan Version' | |
default: 'cura/latest@ultimaker/testing' | |
required: true | |
type: string | |
conan_args: | |
description: 'Conan args: eq.: --require-override' | |
default: '' | |
required: false | |
type: string | |
enterprise: | |
description: 'Build Cura as an Enterprise edition' | |
default: false | |
required: true | |
type: boolean | |
staging: | |
description: 'Use staging API' | |
default: false | |
required: true | |
type: boolean | |
architecture: | |
description: 'Architecture' | |
required: true | |
default: 'X64' | |
type: string | |
operating_system: | |
description: 'OS' | |
required: true | |
default: 'windows-2022' | |
type: string | |
env: | |
CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }} | |
CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }} | |
WIN_CERT_INSTALLER_CER: ${{ secrets.WIN_CERT_INSTALLER_CER }} | |
WIN_CERT_INSTALLER_CER_PASS: ${{ secrets.WIN_CERT_INSTALLER_CER_PASS }} | |
CURA_CONAN_VERSION: ${{ inputs.cura_conan_version }} | |
ENTERPRISE: ${{ inputs.enterprise }} | |
STAGING: ${{ inputs.staging }} | |
jobs: | |
cura-installer-create: | |
runs-on: ${{ inputs.operating_system }} | |
outputs: | |
INSTALLER_FILENAME: ${{ steps.filename.outputs.INSTALLER_FILENAME }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python and pip | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.x' | |
cache: 'pip' | |
cache-dependency-path: .github/workflows/requirements-conan-package.txt | |
- name: Install Python requirements for runner | |
run: pip install -r .github/workflows/requirements-conan-package.txt | |
- name: Cache Conan local repository packages (Powershell) | |
uses: actions/cache@v3 | |
with: | |
path: | | |
C:\Users\runneradmin\.conan\data | |
C:\.conan | |
C:\Users\runneradmin\.conan\conan_download_cache | |
key: conan-${{ runner.os }}-${{ runner.arch }}-installer-cache | |
- name: Create the default Conan profile | |
run: conan profile new default --detect --force | |
- name: Get Conan configuration | |
run: | | |
conan config install https://github.com/Ultimaker/conan-config.git | |
conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}" | |
- name: Use Conan download cache (Powershell) | |
run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache" | |
- name: Create the Packages (Powershell) | |
run: conan install $Env:CURA_CONAN_VERSION ${{ inputs.conan_args }} --build=missing --update -if cura_inst -g VirtualPythonEnv -o cura:enterprise=$Env:ENTERPRISE -o cura:staging=$Env:STAGING -c tools.build:skip_test=True | |
- name: Remove internal packages before uploading | |
run: | | |
conan remove "*@internal/*" -f || true | |
conan remove "cura_private_data*" -f || true | |
- name: Upload the Package(s) | |
if: always() | |
run: | | |
conan upload "*" -r cura --all -c | |
- name: Set Environment variables for Cura (Powershell) | |
run: | | |
echo "${Env:WIX}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
.\cura_inst\Scripts\activate_github_actions_env.ps1 | |
.\cura_inst\Scripts\activate_github_actions_version_env.ps1 | |
# - name: Install OpenSSL shared | |
# run: conan install openssl/1.1.1l@_/_ --build=missing --update -o openssl:shared=True -g deploy | |
# | |
# - name: Copy OpenSSL shared (Powershell) | |
# run: | | |
# cp openssl/bin/*.dll ./cura_inst/Scripts/ | |
# cp openssl/lib/*.lib ./cura_inst/Lib/ | |
- name: Create the Cura dist | |
run: pyinstaller ./cura_inst/UltiMaker-Cura.spec | |
- name: Output the name file name and extension | |
id: filename | |
shell: python | |
run: | | |
import os | |
enterprise = "-Enterprise" if "${{ inputs.enterprise }}" == "true" else "" | |
installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-win64-${{ inputs.architecture }}" | |
output_env = os.environ["GITHUB_OUTPUT"] | |
content = "" | |
if os.path.exists(output_env): | |
with open(output_env, "r") as f: | |
content = f.read() | |
with open(output_env, "w") as f: | |
f.write(content) | |
f.writelines(f"INSTALLER_FILENAME={installer_filename}\n") | |
- name: Summarize the used dependencies | |
shell: python | |
run: | | |
import os | |
from cura.CuraVersion import ConanInstalls, PythonInstalls | |
summary_env = os.environ["GITHUB_STEP_SUMMARY"] | |
content = "" | |
if os.path.exists(summary_env): | |
with open(summary_env, "r") as f: | |
content = f.read() | |
with open(summary_env, "w") as f: | |
f.write(content) | |
f.writelines("# ${{ steps.filename.outputs.INSTALLER_FILENAME }}\n") | |
f.writelines("## Conan packages:\n") | |
for dep_name, dep_info in ConanInstalls.items(): | |
f.writelines(f"`{dep_name} {dep_info['version']} {dep_info['revision']}`\n") | |
f.writelines("## Python modules:\n") | |
for dep_name, dep_info in PythonInstalls.items(): | |
f.writelines(f"`{dep_name} {dep_info['version']}`\n") | |
- name: Create PFX certificate from BASE64_PFX_CONTENT secret | |
id: create-pfx | |
env: | |
PFX_CONTENT: ${{ secrets.WIN_CERT_INSTALLER_CER }} | |
run: | | |
$pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx"; | |
$encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT); | |
Set-Content $pfxPath -Value $encodedBytes -AsByteStream; | |
echo "PFX_PATH=$pfxPath" >> $env:GITHUB_OUTPUT; | |
- name: Create the Windows msi installer (Powershell) | |
run: | | |
python ..\cura_inst\packaging\msi\create_windows_msi.py ..\cura_inst .\UltiMaker-Cura "${{steps.filename.outputs.INSTALLER_FILENAME }}.msi" "$Env:CURA_APP_NAME" | |
working-directory: dist | |
- name: Sign the Windows msi installer (Powershell) | |
env: | |
PFX_PATH: ${{ steps.create-pfx.outputs.PFX_PATH }} | |
run: | | |
& "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{steps.filename.outputs.INSTALLER_FILENAME }}.msi" | |
working-directory: dist | |
- name: Create the Windows exe installer (Powershell) | |
run: | | |
python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "${{steps.filename.outputs.INSTALLER_FILENAME }}.exe" | |
working-directory: dist | |
- name: Sign the Windows exe installer (Powershell) | |
env: | |
PFX_PATH: ${{ steps.create-pfx.outputs.PFX_PATH }} | |
run: | | |
& "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" sign /f $Env:PFX_PATH /p "$Env:WIN_CERT_INSTALLER_CER_PASS" /fd SHA256 /t http://timestamp.digicert.com "${{steps.filename.outputs.INSTALLER_FILENAME }}.exe" | |
working-directory: dist | |
- name: Upload the msi | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{steps.filename.outputs.INSTALLER_FILENAME }}-msi | |
path: | | |
dist/${{steps.filename.outputs.INSTALLER_FILENAME }}.msi | |
retention-days: 5 | |
- name: Upload the exe | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{steps.filename.outputs.INSTALLER_FILENAME }}-exe | |
path: | | |
dist/${{steps.filename.outputs.INSTALLER_FILENAME }}.exe | |
retention-days: 5 | |
# NOTE: The extension is .sh, since this isn't going to build-environment, so not on the Win build image. | |
- name: Write the run info | |
shell: python | |
run: | | |
import os | |
with open("run_info.sh", "w") as f: | |
f.writelines(f'echo "CURA_VERSION_FULL={os.environ["CURA_VERSION_FULL"]}" >> $GITHUB_ENV\n') | |
# NOTE: The extension is .sh, since this isn't going to build-environment, so not on the Win build image. | |
- name: Upload the run info | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows-run-info | |
path: | | |
run_info.sh | |
retention-days: 5 | |
notify-export: | |
if: ${{ always() }} | |
needs: [ cura-installer-create ] | |
uses: ultimaker/cura/.github/workflows/notify.yml@main | |
with: | |
success: ${{ contains(join(needs.*.result, ','), 'success') }} | |
success_title: "Create the Cura distributions" | |
success_body: "Installers for ${{ inputs.cura_conan_version }}" | |
failure_title: "Failed to create the Cura distributions" | |
failure_body: "Failed to create at least 1 installer for ${{ inputs.cura_conan_version }}" | |
secrets: inherit |