Browse Source

Create separate archives per extension

Contribute to CURA-9157 and CURA-6867
Jelle Spijker 2 years ago
parent
commit
6b1722b693
2 changed files with 32 additions and 10 deletions
  1. 1 1
      .github/workflows/cura-all-installers.yml
  2. 31 9
      .github/workflows/cura-installer.yml

+ 1 - 1
.github/workflows/cura-all-installers.yml

@@ -1,5 +1,5 @@
 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 }}
+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 }}
 
 on:
     workflow_dispatch:

+ 31 - 9
.github/workflows/cura-installer.yml

@@ -229,26 +229,48 @@ jobs:
             -   name: Create the Cura dist
                 run: pyinstaller ./cura_inst/UltiMaker-Cura.spec
 
+            -   name: Output the name file name and extension
+                shell: python
+                run: |
+                    import os
+                    enterprise = "-Enterprise" if "${{ inputs.enterprise }}" == "true" else ""
+                    installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-${{ inputs.os_name }}"
+                    if "${{ runner.os }}" == "Windows":
+                        installer_ext = "msi" if "${{ inputs.msi_installer }}" == "true" else "exe"
+                    elif "${{ runner.os }}" == "Macos":
+                        installer_ext = "dmg"
+                    else:
+                        installer_ext = "AppImage"
+                    output_env = os.environ["GITHUB_ENV"]
+                    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")
+                        f.writelines(f"INSTALLER_EXT={installer_ext}\n")
+
             -   name: Archive the artifacts (bash)
                 if: ${{ !inputs.installer && runner.os != 'Windows' }}
-                run: tar -zcf "./UltiMaker-Cura-$CURA_VERSION_FULL-${{ inputs.os_name }}.tar.gz" "./UltiMaker-Cura/"
+                run: tar -zcf "./$INSTALLER_FILENAME.tar.gz" "./UltiMaker-Cura/"
                 working-directory: dist
 
             -   name: Archive the artifacts (Powershell)
                 if: ${{ !inputs.installer && runner.os == 'Windows' }}
-                run: Compress-Archive -Path ".\UltiMaker-Cura" -DestinationPath ".\UltiMaker-Cura-$Env:CURA_VERSION_FULL-${{ inputs.os_name }}.zip"
+                run: Compress-Archive -Path ".\UltiMaker-Cura" -DestinationPath ".\$Env:INSTALLER_FILENAME.zip"
                 working-directory: dist
 
             -   name: Create the Windows exe installer (Powershell)
                 if: ${{ inputs.installer && runner.os == 'Windows' && !inputs.msi_installer }}
                 run: |
-                    python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "UltiMaker-Cura-$Env:CURA_VERSION_FULL-${{ inputs.os_name }}.exe"
+                    python ..\cura_inst\packaging\NSIS\create_windows_installer.py ../cura_inst . "$Env:INSTALLER_FILENAME.$Env:INSTALLER_EXT"
                 working-directory: dist
 
             -   name: Create the Windows msi installer (Powershell)
                 if: ${{ inputs.installer && runner.os == 'Windows' && inputs.msi_installer }}
                 run: |
-                    python ..\cura_inst\packaging\msi\create_windows_msi.py ..\cura_inst .\UltiMaker-Cura "UltiMaker-Cura-$Env:CURA_VERSION_FULL-${{ inputs.os_name }}.msi" "$Env:CURA_APP_NAME"
+                    python ..\cura_inst\packaging\msi\create_windows_msi.py ..\cura_inst .\UltiMaker-Cura "$Env:INSTALLER_FILENAME.$Env:INSTALLER_EXT" "$Env:CURA_APP_NAME"
                 working-directory: dist
 
             -   name: Sign the Windows exe installer (Powershell)
@@ -256,7 +278,7 @@ jobs:
                 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 "UltiMaker-Cura-$Env:CURA_VERSION_FULL-${{ inputs.os_name }}.exe"
+                    & "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 "$Env:INSTALLER_FILENAME.$Env:INSTALLER_EXT"
                 working-directory: dist
 
             -   name: Sign the Windows msi installer (Powershell)
@@ -264,23 +286,23 @@ jobs:
                 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 "UltiMaker-Cura-$Env:CURA_VERSION_FULL-${{ inputs.os_name }}.msi"
+                    & "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 "$Env:INSTALLER_FILENAME.$Env:INSTALLER_EXT"
                 working-directory: dist
 
             -   name: Create the Linux AppImage (Bash)
                 if: ${{ inputs.installer && runner.os == 'Linux' }}
-                run: python ../cura_inst/packaging/AppImage/create_appimage.py ./UltiMaker-Cura $CURA_VERSION_FULL "UltiMaker-Cura-$CURA_VERSION_FULL-${{ inputs.os_name }}.AppImage"
+                run: python ../cura_inst/packaging/AppImage/create_appimage.py ./UltiMaker-Cura $CURA_VERSION_FULL "$Env:INSTALLER_FILENAME.$Env:INSTALLER_EXT"
                 working-directory: dist
 
             -   name: Create the MacOS dmg (Bash)
                 if: ${{ inputs.installer && runner.os == 'Macos' }}
-                run: python ../cura_inst/packaging/dmg/dmg_sign_noterize.py ../cura_inst . "UltiMaker-Cura-$CURA_VERSION_FULL-${{ inputs.os_name }}.dmg"
+                run: python ../cura_inst/packaging/dmg/dmg_sign_noterize.py ../cura_inst . "$Env:INSTALLER_FILENAME.$Env:INSTALLER_EXT"
                 working-directory: dist
 
             -   name: Upload the artifacts
                 uses: actions/upload-artifact@v3
                 with:
-                    name: UltiMaker-Cura-${{ env.CURA_VERSION_FULL }}-${{ inputs.os_name }}
+                    name: "$Env:INSTALLER_FILENAME-$Env:INSTALLER_EXT"
                     path: |
                         dist/*.tar.gz
                         dist/*.zip