installers.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. name: All installers
  2. run-name: ${{ inputs.cura_conan_version }} by @${{ github.actor }}
  3. on:
  4. workflow_dispatch:
  5. inputs:
  6. cura_conan_version:
  7. description: 'Cura Conan Version'
  8. default: 'cura/latest@ultimaker/testing'
  9. required: true
  10. type: string
  11. conan_args:
  12. description: 'Conan args: eq.: --require-override'
  13. default: ''
  14. required: false
  15. type: string
  16. enterprise:
  17. description: 'Build Cura as an Enterprise edition'
  18. default: false
  19. required: true
  20. type: boolean
  21. staging:
  22. description: 'Use staging API'
  23. default: false
  24. required: true
  25. type: boolean
  26. nightly:
  27. description: 'Upload to nightly release'
  28. default: false
  29. required: true
  30. type: boolean
  31. schedule:
  32. # Daily at 5:15 CET
  33. - cron: '15 3 * * *'
  34. env:
  35. CURA_CONAN_VERSION: ${{ inputs.cura_conan_version || 'cura/latest@ultimaker/testing' }}
  36. CONAN_ARGS: ${{ inputs.conan_args || '' }}
  37. ENTERPRISE: ${{ inputs.enterprise || false }}
  38. STAGING: ${{ inputs.staging || false }}
  39. jobs:
  40. default-values:
  41. runs-on: ubuntu-latest
  42. outputs:
  43. cura_conan_version: ${{ steps.default.outputs.cura_conan_version }}
  44. steps:
  45. - name: Output default values
  46. id: default
  47. shell: python
  48. run: |
  49. import os
  50. cura_conan_version = "cura/latest@ultimaker/testing" if "${{ github.event.inputs.cura_conan_version }}" == "" else "${{ github.event.inputs.cura_conan_version }}"
  51. output_env = os.environ["GITHUB_OUTPUT"]
  52. content = ""
  53. if os.path.exists(output_env):
  54. with open(output_env, "r") as f:
  55. content = f.read()
  56. with open(output_env, "w") as f:
  57. f.write(content)
  58. f.writelines(f"cura_conan_version={cura_conan_version}\n")
  59. windows-installer:
  60. uses: ./.github/workflows/windows.yml
  61. needs: [ default-values ]
  62. with:
  63. cura_conan_version: ${{ needs.default-values.outputs.cura_conan_version }}
  64. conan_args: ${{ github.event.inputs.conan_args }}
  65. enterprise: ${{ github.event.inputs.enterprise == 'true' }}
  66. staging: ${{ github.event.inputs.staging == 'true' }}
  67. architecture: X64
  68. operating_system: windows-2022
  69. secrets: inherit
  70. linux-installer:
  71. uses: ./.github/workflows/linux.yml
  72. needs: [ default-values ]
  73. with:
  74. cura_conan_version: ${{ needs.default-values.outputs.cura_conan_version }}
  75. conan_args: ${{ github.event.inputs.conan_args }}
  76. enterprise: ${{ github.event.inputs.enterprise == 'true' }}
  77. staging: ${{ github.event.inputs.staging == 'true' }}
  78. architecture: X64
  79. operating_system: ubuntu-22.04
  80. secrets: inherit
  81. macos-installer:
  82. uses: ./.github/workflows/macos.yml
  83. needs: [ default-values ]
  84. with:
  85. cura_conan_version: ${{ needs.default-values.outputs.cura_conan_version }}
  86. conan_args: ${{ github.event.inputs.conan_args }}
  87. enterprise: ${{ github.event.inputs.enterprise == 'true' }}
  88. staging: ${{ github.event.inputs.staging == 'true' }}
  89. architecture: X64
  90. operating_system: macos-11.0
  91. secrets: inherit
  92. macos-arm-installer:
  93. uses: ./.github/workflows/macos.yml
  94. needs: [ default-values ]
  95. with:
  96. cura_conan_version: ${{ needs.default-values.outputs.cura_conan_version }}
  97. conan_args: ${{ github.event.inputs.conan_args }}
  98. enterprise: ${{ github.event.inputs.enterprise == 'true' }}
  99. staging: ${{ github.event.inputs.staging == 'true' }}
  100. architecture: ARM64
  101. operating_system: self-hosted
  102. secrets: inherit
  103. # Run and update nightly release when the nightly input is set to true or if the schedule is triggered
  104. update-nightly-release:
  105. if: ${{ inputs.nightly || github.event_name == 'schedule' }}
  106. runs-on: ubuntu-latest
  107. needs: [ windows-installer, linux-installer, macos-installer, macos-arm-installer ]
  108. steps:
  109. - name: Checkout
  110. uses: actions/checkout@v3
  111. # It's not necessary to download all three, but it does make sure we have at least one if an OS is skipped.
  112. - name: Download the run info
  113. uses: actions/download-artifact@v2
  114. with:
  115. name: linux-run-info
  116. - name: Set the run info as environment variables
  117. run: |
  118. . run_info.sh
  119. - name: Output the name file name and extension
  120. id: filename
  121. shell: python
  122. run: |
  123. import os
  124. import datetime
  125. enterprise = "-Enterprise" if "${{ github.event.inputs.enterprise }}" == "true" else ""
  126. linux = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-linux-X64"
  127. mac_x64_dmg = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-X64"
  128. mac_x64_pkg = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-X64"
  129. mac_arm_dmg = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-ARM64"
  130. mac_arm_pkg = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-ARM64"
  131. win_msi = installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-win64-X64"
  132. win_exe = installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-win64-X64"
  133. nightly_name = "UltiMaker-Cura-" + os.getenv('CURA_VERSION_FULL').split("+")[0]
  134. nightly_creation_time = str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
  135. output_env = os.environ["GITHUB_OUTPUT"]
  136. content = ""
  137. if os.path.exists(output_env):
  138. with open(output_env, "r") as f:
  139. content = f.read()
  140. with open(output_env, "w") as f:
  141. f.write(content)
  142. f.writelines(f"LINUX={linux}\n")
  143. f.writelines(f"MAC_X64_DMG={mac_x64_dmg}\n")
  144. f.writelines(f"MAC_X64_PKG={mac_x64_pkg}\n")
  145. f.writelines(f"MAC_ARM_DMG={mac_arm_dmg}\n")
  146. f.writelines(f"MAC_ARM_PKG={mac_arm_pkg}\n")
  147. f.writelines(f"WIN_MSI={win_msi}\n")
  148. f.writelines(f"WIN_EXE={win_exe}\n")
  149. f.writelines(f"NIGHTLY_NAME={nightly_name}\n")
  150. f.writelines(f"NIGHTLY_TIME={nightly_creation_time}\n")
  151. - name: Download linux installer jobs artifacts
  152. uses: actions/download-artifact@v2
  153. with:
  154. name: ${{ steps.filename.outputs.LINUX }}-AppImage
  155. path: installers
  156. - name: Rename Linux installer to nightlies
  157. run: |
  158. mv installers/${{ steps.filename.outputs.LINUX }}.AppImage installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-linux-X64.AppImage
  159. - name: Update nightly release for Linux
  160. run: |
  161. gh release upload nightly installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-linux-X64.AppImage --clobber
  162. env:
  163. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  164. - name: Download win msi installer jobs artifacts
  165. uses: actions/download-artifact@v2
  166. with:
  167. name: ${{ steps.filename.outputs.WIN_MSI }}-msi
  168. path: installers
  169. - name: Download win exe installer jobs artifacts
  170. uses: actions/download-artifact@v2
  171. with:
  172. name: ${{ steps.filename.outputs.WIN_EXE }}-exe
  173. path: installers
  174. - name: Rename Windows installers to nightlies
  175. run: |
  176. mv installers/${{ steps.filename.outputs.WIN_MSI }}.msi installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.msi
  177. mv installers/${{ steps.filename.outputs.WIN_EXE }}.exe installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.exe
  178. - name: Update nightly release for Windows
  179. run: |
  180. gh release upload nightly installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.msi --clobber
  181. gh release upload nightly installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.exe --clobber
  182. env:
  183. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  184. - name: Download MacOS (X64) dmg installer jobs artifacts
  185. uses: actions/download-artifact@v2
  186. with:
  187. name: ${{ steps.filename.outputs.MAC_X64_DMG }}-dmg
  188. path: installers
  189. - name: Download MacOS (X64) pkg installer jobs artifacts
  190. uses: actions/download-artifact@v2
  191. with:
  192. name: ${{ steps.filename.outputs.MAC_X64_PKG }}-pkg
  193. path: installers
  194. - name: Rename MacOS (X64) installers to nightlies
  195. run: |
  196. mv installers/${{ steps.filename.outputs.MAC_X64_DMG }}.dmg installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.dmg
  197. mv installers/${{ steps.filename.outputs.MAC_X64_PKG }}.pkg installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.pkg
  198. - name: Update nightly release for MacOS (X64)
  199. run: |
  200. gh release upload nightly installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.dmg --clobber
  201. gh release upload nightly installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.pkg --clobber
  202. env:
  203. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  204. - name: Download MacOS (ARM-64) dmg installer jobs artifacts
  205. uses: actions/download-artifact@v2
  206. with:
  207. name: ${{ steps.filename.outputs.MAC_ARM_DMG }}-dmg
  208. path: installers
  209. - name: Download MacOS (ARM-64) pkg installer jobs artifacts
  210. uses: actions/download-artifact@v2
  211. with:
  212. name: ${{ steps.filename.outputs.MAC_ARM_PKG }}-pkg
  213. path: installers
  214. - name: Rename MacOS (ARM-64) installers to nightlies
  215. run: |
  216. mv installers/${{ steps.filename.outputs.MAC_ARM_DMG }}.dmg installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.dmg
  217. mv installers/${{ steps.filename.outputs.MAC_ARM_PKG }}.pkg installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.pkg
  218. - name: Update nightly release for MacOS (ARM-64)
  219. run: |
  220. gh release upload nightly installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.dmg --clobber
  221. gh release upload nightly installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.pkg --clobber
  222. env:
  223. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  224. - name: Update nightly release description (with date)
  225. if: always()
  226. run: |
  227. gh release edit nightly --title "${{ steps.filename.outputs.NIGHTLY_NAME }}" --notes "Nightly release created on: ${{ steps.filename.outputs.NIGHTLY_TIME }}"
  228. env:
  229. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}