installers.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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 4:15 CET (main-branch) and 5:15 CET (release-branch)
  33. - cron: '15 3 * * *'
  34. - cron: '15 4 * * *'
  35. env:
  36. CONAN_ARGS: ${{ inputs.conan_args || '' }}
  37. ENTERPRISE: ${{ inputs.enterprise || false }}
  38. STAGING: ${{ inputs.staging || false }}
  39. LATEST_RELEASE: '5.6'
  40. LATEST_RELEASE_SCHEDULE_HOUR: 4
  41. jobs:
  42. default_values:
  43. runs-on: ubuntu-latest
  44. outputs:
  45. cura_conan_version: ${{ steps.default.outputs.cura_conan_version }}
  46. release_tag: ${{ steps.default.outputs.release_tag }}
  47. steps:
  48. - name: Output default values
  49. id: default
  50. shell: python
  51. run: |
  52. import os
  53. import datetime
  54. if "${{ github.event_name }}" != "schedule":
  55. cura_conan_version = "${{ github.event.inputs.cura_conan_version }}"
  56. else:
  57. now = datetime.datetime.now()
  58. cura_conan_version = "cura/latest@ultimaker/stable" if now.hour == int(os.environ['LATEST_RELEASE_SCHEDULE_HOUR']) else "cura/latest@ultimaker/testing"
  59. release_tag = f"nightly-{os.environ['LATEST_RELEASE']}" if "/stable" in cura_conan_version else "nightly"
  60. # Set cura_conan_version environment variable
  61. output_env = os.environ["GITHUB_OUTPUT"]
  62. content = ""
  63. if os.path.exists(output_env):
  64. with open(output_env, "r") as f:
  65. content = f.read()
  66. with open(output_env, "w") as f:
  67. f.write(content)
  68. f.writelines(f"cura_conan_version={cura_conan_version}\n")
  69. f.writelines(f"release_tag={release_tag}\n")
  70. summary_env = os.environ["GITHUB_STEP_SUMMARY"]
  71. content = ""
  72. if os.path.exists(summary_env):
  73. with open(summary_env, "r") as f:
  74. content = f.read()
  75. with open(summary_env, "w") as f:
  76. f.write(content)
  77. f.writelines(f"# cura_conan_version = {cura_conan_version}\n")
  78. f.writelines(f"# release_tag = {release_tag}\n")
  79. windows-installer:
  80. uses: ./.github/workflows/windows.yml
  81. needs: [ default_values ]
  82. with:
  83. cura_conan_version: ${{ needs.default_values.outputs.cura_conan_version }}
  84. conan_args: ${{ github.event.inputs.conan_args }}
  85. enterprise: ${{ github.event.inputs.enterprise == 'true' }}
  86. staging: ${{ github.event.inputs.staging == 'true' }}
  87. architecture: X64
  88. operating_system: windows-2022
  89. secrets: inherit
  90. linux-installer:
  91. uses: ./.github/workflows/linux.yml
  92. needs: [ default_values ]
  93. with:
  94. cura_conan_version: ${{ needs.default_values.outputs.cura_conan_version }}
  95. conan_args: ${{ github.event.inputs.conan_args }}
  96. enterprise: ${{ github.event.inputs.enterprise == 'true' }}
  97. staging: ${{ github.event.inputs.staging == 'true' }}
  98. architecture: X64
  99. operating_system: ubuntu-22.04
  100. secrets: inherit
  101. macos-installer:
  102. uses: ./.github/workflows/macos.yml
  103. needs: [ default_values ]
  104. with:
  105. cura_conan_version: ${{ needs.default_values.outputs.cura_conan_version }}
  106. conan_args: ${{ github.event.inputs.conan_args }}
  107. enterprise: ${{ github.event.inputs.enterprise == 'true' }}
  108. staging: ${{ github.event.inputs.staging == 'true' }}
  109. architecture: X64
  110. operating_system: self-hosted-X64
  111. secrets: inherit
  112. macos-arm-installer:
  113. uses: ./.github/workflows/macos.yml
  114. needs: [ default_values ]
  115. with:
  116. cura_conan_version: ${{ needs.default_values.outputs.cura_conan_version }}
  117. conan_args: ${{ github.event.inputs.conan_args }}
  118. enterprise: ${{ github.event.inputs.enterprise == 'true' }}
  119. staging: ${{ github.event.inputs.staging == 'true' }}
  120. architecture: ARM64
  121. operating_system: self-hosted-ARM64
  122. secrets: inherit
  123. # Run and update nightly release when the nightly input is set to true or if the schedule is triggered
  124. update-nightly-release:
  125. if: ${{ inputs.nightly || github.event_name == 'schedule' }}
  126. runs-on: ubuntu-latest
  127. needs: [ default_values, windows-installer, linux-installer, macos-installer, macos-arm-installer ]
  128. steps:
  129. - name: Checkout
  130. uses: actions/checkout@v3
  131. # It's not necessary to download all three, but it does make sure we have at least one if an OS is skipped.
  132. - name: Download the run info
  133. uses: actions/download-artifact@v2
  134. with:
  135. name: linux-run-info
  136. - name: Set the run info as environment variables
  137. run: |
  138. . run_info.sh
  139. - name: Output the name file name and extension
  140. id: filename
  141. shell: python
  142. run: |
  143. import os
  144. import datetime
  145. enterprise = "-Enterprise" if "${{ github.event.inputs.enterprise }}" == "true" else ""
  146. linux = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-linux-X64"
  147. mac_x64_dmg = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-X64"
  148. mac_x64_pkg = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-X64"
  149. mac_arm_dmg = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-ARM64"
  150. mac_arm_pkg = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-macos-ARM64"
  151. win_msi = installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-win64-X64"
  152. win_exe = installer_filename = f"UltiMaker-Cura-{os.getenv('CURA_VERSION_FULL')}{enterprise}-win64-X64"
  153. nightly_name = "UltiMaker-Cura-" + os.getenv('CURA_VERSION_FULL').split("+")[0]
  154. nightly_creation_time = str(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
  155. output_env = os.environ["GITHUB_OUTPUT"]
  156. content = ""
  157. if os.path.exists(output_env):
  158. with open(output_env, "r") as f:
  159. content = f.read()
  160. with open(output_env, "w") as f:
  161. f.write(content)
  162. f.writelines(f"LINUX={linux}\n")
  163. f.writelines(f"MAC_X64_DMG={mac_x64_dmg}\n")
  164. f.writelines(f"MAC_X64_PKG={mac_x64_pkg}\n")
  165. f.writelines(f"MAC_ARM_DMG={mac_arm_dmg}\n")
  166. f.writelines(f"MAC_ARM_PKG={mac_arm_pkg}\n")
  167. f.writelines(f"WIN_MSI={win_msi}\n")
  168. f.writelines(f"WIN_EXE={win_exe}\n")
  169. f.writelines(f"NIGHTLY_NAME={nightly_name}\n")
  170. f.writelines(f"NIGHTLY_TIME={nightly_creation_time}\n")
  171. - name: Download linux installer jobs artifacts
  172. uses: actions/download-artifact@v2
  173. with:
  174. name: ${{ steps.filename.outputs.LINUX }}-AppImage
  175. path: installers
  176. - name: Download linux installer jobs asc artifacts
  177. uses: actions/download-artifact@v2
  178. with:
  179. name: ${{ steps.filename.outputs.LINUX }}-asc
  180. path: installers
  181. - name: Rename Linux installer to nightlies
  182. run: |
  183. mv installers/${{ steps.filename.outputs.LINUX }}.AppImage installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-linux-X64.AppImage
  184. mv installers/${{ steps.filename.outputs.LINUX }}.AppImage.asc installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-linux-X64.AppImage.asc
  185. - name: Update nightly release for Linux
  186. run: |
  187. gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-linux-X64.AppImage --clobber
  188. gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-linux-X64.AppImage.asc --clobber
  189. env:
  190. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  191. - name: Download win msi installer jobs artifacts
  192. uses: actions/download-artifact@v2
  193. with:
  194. name: ${{ steps.filename.outputs.WIN_MSI }}-msi
  195. path: installers
  196. - name: Download win exe installer jobs artifacts
  197. uses: actions/download-artifact@v2
  198. with:
  199. name: ${{ steps.filename.outputs.WIN_EXE }}-exe
  200. path: installers
  201. - name: Rename Windows installers to nightlies
  202. run: |
  203. mv installers/${{ steps.filename.outputs.WIN_MSI }}.msi installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.msi
  204. mv installers/${{ steps.filename.outputs.WIN_EXE }}.exe installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.exe
  205. - name: Update nightly release for Windows
  206. run: |
  207. gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.msi --clobber
  208. gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-win64-X64.exe --clobber
  209. env:
  210. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  211. - name: Download MacOS (X64) dmg installer jobs artifacts
  212. uses: actions/download-artifact@v2
  213. with:
  214. name: ${{ steps.filename.outputs.MAC_X64_DMG }}-dmg
  215. path: installers
  216. - name: Download MacOS (X64) pkg installer jobs artifacts
  217. uses: actions/download-artifact@v2
  218. with:
  219. name: ${{ steps.filename.outputs.MAC_X64_PKG }}-pkg
  220. path: installers
  221. - name: Rename MacOS (X64) installers to nightlies
  222. run: |
  223. mv installers/${{ steps.filename.outputs.MAC_X64_DMG }}.dmg installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.dmg
  224. mv installers/${{ steps.filename.outputs.MAC_X64_PKG }}.pkg installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.pkg
  225. - name: Update nightly release for MacOS (X64)
  226. run: |
  227. gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.dmg --clobber
  228. gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-X64.pkg --clobber
  229. env:
  230. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  231. - name: Download MacOS (ARM-64) dmg installer jobs artifacts
  232. uses: actions/download-artifact@v2
  233. with:
  234. name: ${{ steps.filename.outputs.MAC_ARM_DMG }}-dmg
  235. path: installers
  236. - name: Download MacOS (ARM-64) pkg installer jobs artifacts
  237. uses: actions/download-artifact@v2
  238. with:
  239. name: ${{ steps.filename.outputs.MAC_ARM_PKG }}-pkg
  240. path: installers
  241. - name: Rename MacOS (ARM-64) installers to nightlies
  242. run: |
  243. mv installers/${{ steps.filename.outputs.MAC_ARM_DMG }}.dmg installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.dmg
  244. mv installers/${{ steps.filename.outputs.MAC_ARM_PKG }}.pkg installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.pkg
  245. - name: Update nightly release for MacOS (ARM-64)
  246. run: |
  247. gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.dmg --clobber
  248. gh release upload ${{ needs.default_values.outputs.release_tag }} installers/${{ steps.filename.outputs.NIGHTLY_NAME }}-macos-ARM64.pkg --clobber
  249. env:
  250. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  251. - name: create the release notes
  252. shell: python
  253. run: |
  254. import os
  255. import datetime
  256. from jinja2 import Template
  257. with open(".github/workflows/release_notes.md.jinja", "r") as f:
  258. release_notes = Template(f.read())
  259. current_nightly_beta = "${{ needs.default_values.outputs.release_tag }}".split("nightly-")[-1]
  260. with open("release-notes.md", "w") as f:
  261. f.write(release_notes.render(
  262. timestamp="${{ steps.filename.outputs.NIGHTLY_TIME }}",
  263. branch="" if "${{ needs.default-values.outputs.release_tag == 'nightly' }}" == 'true' else current_nightly_beta,
  264. branch_specific="" if os.getenv("GITHUB_REF") == "refs/heads/main" else f"?branch={current_nightly_beta}",
  265. ))
  266. - name: Update nightly release description (with date)
  267. if: always()
  268. run: |
  269. gh release edit ${{ needs.default_values.outputs.release_tag }} --title "${{ steps.filename.outputs.NIGHTLY_NAME }}" --notes-file release-notes.md
  270. env:
  271. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}