installers.yml 12 KB

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