mirror of
https://github.com/Ultimaker/Cura.git
synced 2026-03-04 09:34:35 -07:00
A daily schedule for the update-nightly-release workflow was added. Now, apart from when the 'nightly' input is set to true, the release update will be triggered everyday at 5:20 CET. This functionality allows more up to date releases without manual input. Also, installer file names were updated and it now includes the daily creation timestamp which provides visibility on when the nightly build was generated. Contributes to CURA-9494
280 lines
No EOL
12 KiB
YAML
280 lines
No EOL
12 KiB
YAML
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 --json "cura_inst/conan_install_info.json"
|
|
|
|
- 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 Conan dependencies
|
|
shell: python
|
|
run: |
|
|
import os
|
|
import json
|
|
from pathlib import Path
|
|
|
|
conan_install_info_path = Path("cura_inst/conan_install_info.json")
|
|
conan_info = {"installed": []}
|
|
if os.path.exists(conan_install_info_path):
|
|
with open(conan_install_info_path, "r") as f:
|
|
conan_info = json.load(f)
|
|
sorted_deps = sorted([dep["recipe"]["id"].replace('#', r' rev: ') for dep in conan_info["installed"]])
|
|
|
|
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 in sorted_deps:
|
|
f.writelines(f"`{dep}`\n")
|
|
|
|
- name: Summarize the used Python modules
|
|
shell: python
|
|
run: |
|
|
import os
|
|
import pkg_resources
|
|
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("## Python modules:\n")
|
|
for package in pkg_resources.working_set:
|
|
f.writelines(f"`{package.key}/{package.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
|
|
|
|
- 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')
|
|
|
|
- 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 |