gen-images.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. name: Build void images
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. datecode:
  6. description: "Override datecode for images"
  7. required: false
  8. type: string
  9. live_iso_flag:
  10. description: "Build live ISOs"
  11. default: true
  12. required: true
  13. type: boolean
  14. live_archs:
  15. description: "Archs to build live ISOs for"
  16. default: "x86_64 x86_64-musl i686 aarch64 aarch64-musl"
  17. required: false
  18. type: string
  19. live_flavors:
  20. description: "Flavors to build live ISOs for"
  21. default: "base xfce"
  22. required: false
  23. type: string
  24. rootfs_flag:
  25. description: "Build ROOTFSes"
  26. default: true
  27. required: true
  28. type: boolean
  29. rootfs:
  30. description: "Archs to build ROOTFSes for"
  31. default: "x86_64 x86_64-musl i686 armv6l armv6l-musl armv7l armv7l-musl aarch64 aarch64-musl"
  32. required: false
  33. type: string
  34. platformfs_flag:
  35. description: "Build PLATFORMFSes"
  36. default: true
  37. required: true
  38. type: boolean
  39. platformfs:
  40. description: "Platforms to build PLATFORMFSes for"
  41. default: "rpi-armv6l rpi-armv6l-musl rpi-armv7l rpi-armv7l-musl rpi-aarch64 rpi-aarch64-musl"
  42. required: false
  43. type: string
  44. sbc_img_flag:
  45. description: "Build SBC Images"
  46. default: true
  47. required: true
  48. type: boolean
  49. sbc_imgs:
  50. description: "Platforms to build SBC images for"
  51. default: "rpi-armv6l rpi-armv6l-musl rpi-armv7l rpi-armv7l-musl rpi-aarch64 rpi-aarch64-musl"
  52. required: false
  53. type: string
  54. concurrency:
  55. group: ${{ github.workflow }}-${{ github.ref }}
  56. cancel-in-progress: true
  57. defaults:
  58. run:
  59. shell: bash
  60. jobs:
  61. prepare:
  62. name: Prepare Environment
  63. runs-on: ubuntu-latest
  64. outputs:
  65. datecode: ${{ steps.prep.outputs.datecode }}
  66. revision: ${{ steps.prep.outputs.revision }}
  67. mirror: ${{ steps.prep.outputs.mirror }}
  68. live_archs: ${{ steps.prep.outputs.live_archs }}
  69. live_flavors: ${{ steps.prep.outputs.live_flavors }}
  70. rootfs: ${{ steps.prep.outputs.rootfs }}
  71. platformfs: ${{ steps.prep.outputs.platformfs }}
  72. sbc_imgs: ${{ steps.prep.outputs.sbc_imgs }}
  73. steps:
  74. - name: Prepare Environment
  75. id: prep
  76. run: |
  77. if [ -z "${{ inputs.datecode }}" ]; then
  78. echo "datecode=$(date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
  79. else
  80. echo "datecode=${{ inputs.datecode }}" >> $GITHUB_OUTPUT
  81. fi
  82. echo "revision=${GITHUB_SHA:0:8}" >> $GITHUB_OUTPUT
  83. echo "mirror=https://repo-ci.voidlinux.org/current" >> $GITHUB_OUTPUT
  84. jsonify() {
  85. sed 's/\s\+/ /g' | jq -Rrc 'split(" ")'
  86. }
  87. echo "live_archs=$(echo "${{ inputs.live_archs }}" | jsonify)" >> $GITHUB_OUTPUT
  88. echo "live_flavors=$(echo "${{ inputs.live_flavors }}" | jsonify)" >> $GITHUB_OUTPUT
  89. echo "rootfs=$(echo "${{ inputs.rootfs }}" | jsonify)" >> $GITHUB_OUTPUT
  90. echo "platformfs=$(echo "${{ inputs.platformfs }}" | jsonify)" >> $GITHUB_OUTPUT
  91. echo "sbc_imgs=$(echo "${{ inputs.sbc_imgs }}" | jsonify)" >> $GITHUB_OUTPUT
  92. build-live-isos:
  93. name: Build Live ISOs
  94. runs-on: ubuntu-latest
  95. needs: prepare
  96. if: ${{ inputs.live_iso_flag }}
  97. strategy:
  98. matrix:
  99. arch: ${{ fromJson(needs.prepare.outputs.live_archs) }}
  100. flavor: ${{ fromJson(needs.prepare.outputs.live_flavors) }}
  101. container:
  102. image: 'ghcr.io/void-linux/void-mklive:20250116R1'
  103. options: --privileged
  104. volumes:
  105. - /dev:/dev
  106. env:
  107. PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
  108. MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
  109. steps:
  110. - name: Prepare container
  111. shell: sh
  112. run: xbps-install -Syu xbps && xbps-install -yu
  113. - name: Clone and checkout
  114. uses: classabbyamp/treeless-checkout-action@v1
  115. - name: Build live ISOs
  116. run: |
  117. make live-iso-all-print live-iso-all \
  118. SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
  119. DATECODE="${{ needs.prepare.outputs.datecode }}" \
  120. LIVE_ARCHS="${{ matrix.arch }}" LIVE_FLAVORS="${{ matrix.flavor }}"
  121. - name: Prepare artifacts for upload
  122. run: |
  123. make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
  124. - name: Upload artifacts
  125. uses: actions/upload-artifact@v4
  126. with:
  127. name: void-iso-${{ matrix.arch }}-${{ matrix.flavor }}-${{ needs.prepare.outputs.datecode }}
  128. path: |
  129. distdir-${{ needs.prepare.outputs.datecode }}/*
  130. if-no-files-found: error
  131. build-rootfs:
  132. name: Build ROOTFSes
  133. runs-on: ubuntu-latest
  134. needs: prepare
  135. if: ${{ inputs.rootfs_flag }}
  136. strategy:
  137. matrix:
  138. arch: ${{ fromJson(needs.prepare.outputs.rootfs) }}
  139. container:
  140. image: 'ghcr.io/void-linux/void-mklive:20250116R1'
  141. options: --privileged
  142. volumes:
  143. - /dev:/dev
  144. env:
  145. PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
  146. MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
  147. steps:
  148. - name: Prepare container
  149. shell: sh
  150. run: xbps-install -Syu xbps && xbps-install -yu
  151. - name: Clone and checkout
  152. uses: classabbyamp/treeless-checkout-action@v1
  153. - name: Build ROOTFSes
  154. run: |
  155. make rootfs-all-print rootfs-all \
  156. SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
  157. DATECODE="${{ needs.prepare.outputs.datecode }}" \
  158. ARCHS="${{ matrix.arch }}"
  159. - name: Prepare artifacts for upload
  160. run: |
  161. make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
  162. - name: Upload artifacts
  163. uses: actions/upload-artifact@v4
  164. with:
  165. name: void-rootfs-${{ matrix.arch }}-${{ needs.prepare.outputs.datecode }}
  166. path: |
  167. distdir-${{ needs.prepare.outputs.datecode }}/*
  168. if-no-files-found: error
  169. build-platformfs:
  170. name: Build PLATFORMFSes
  171. runs-on: ubuntu-latest
  172. needs: prepare
  173. if: ${{ inputs.platformfs_flag }}
  174. strategy:
  175. matrix:
  176. platform: ${{ fromJson(needs.prepare.outputs.platformfs) }}
  177. container:
  178. image: 'ghcr.io/void-linux/void-mklive:20250116R1'
  179. options: --privileged
  180. volumes:
  181. - /dev:/dev
  182. env:
  183. PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
  184. MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
  185. steps:
  186. - name: Prepare container
  187. shell: sh
  188. run: xbps-install -Syu xbps && xbps-install -yu
  189. - name: Clone and checkout
  190. uses: classabbyamp/treeless-checkout-action@v1
  191. - name: Build PLATFORMFSes
  192. run: |
  193. make platformfs-all-print platformfs-all \
  194. SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
  195. DATECODE="${{ needs.prepare.outputs.datecode }}" \
  196. PLATFORMS="${{ matrix.platform }}"
  197. - name: Prepare artifacts for upload
  198. run: |
  199. make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
  200. - name: Upload artifacts
  201. uses: actions/upload-artifact@v4
  202. with:
  203. name: void-platformfs-${{ matrix.platform }}-${{ needs.prepare.outputs.datecode }}
  204. path: |
  205. distdir-${{ needs.prepare.outputs.datecode }}/*
  206. !distdir-${{ needs.prepare.outputs.datecode }}/*ROOTFS*
  207. if-no-files-found: error
  208. build-sbc-img:
  209. name: Build SBC Images
  210. runs-on: ubuntu-latest
  211. needs: prepare
  212. if: ${{ inputs.sbc_img_flag }}
  213. strategy:
  214. matrix:
  215. platform: ${{ fromJson(needs.prepare.outputs.sbc_imgs) }}
  216. container:
  217. image: 'ghcr.io/void-linux/void-mklive:20250116R1'
  218. options: --privileged
  219. volumes:
  220. - /dev:/dev
  221. env:
  222. PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
  223. MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
  224. steps:
  225. - name: Prepare container
  226. shell: sh
  227. run: xbps-install -Syu xbps && xbps-install -yu
  228. - name: Clone and checkout
  229. uses: classabbyamp/treeless-checkout-action@v1
  230. - name: Build SBC Images
  231. run: |
  232. make images-all-sbc-print images-all-sbc \
  233. SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
  234. DATECODE="${{ needs.prepare.outputs.datecode }}" \
  235. SBC_IMGS="${{ matrix.platform }}"
  236. - name: Prepare artifacts for upload
  237. run: |
  238. make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
  239. - name: Upload artifacts
  240. uses: actions/upload-artifact@v4
  241. with:
  242. name: void-sbc-img-${{ matrix.platform }}-${{ needs.prepare.outputs.datecode }}
  243. path: |
  244. distdir-${{ needs.prepare.outputs.datecode }}/*
  245. !distdir-${{ needs.prepare.outputs.datecode }}/*ROOTFS*
  246. !distdir-${{ needs.prepare.outputs.datecode }}/*PLATFORMFS*
  247. if-no-files-found: error
  248. merge-artifacts:
  249. name: Combine artifacts
  250. runs-on: ubuntu-latest
  251. if: ${{ always() }}
  252. needs:
  253. - prepare
  254. - build-live-isos
  255. - build-rootfs
  256. - build-platformfs
  257. - build-sbc-img
  258. container:
  259. image: 'ghcr.io/void-linux/void-mklive:20250116R1'
  260. env:
  261. PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
  262. MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
  263. steps:
  264. - name: Prepare container
  265. shell: sh
  266. run: xbps-install -Syu xbps && xbps-install -yu
  267. - name: Clone and checkout
  268. uses: classabbyamp/treeless-checkout-action@v1
  269. - name: Download artifacts
  270. uses: actions/download-artifact@v4
  271. with:
  272. path: distdir-${{ needs.prepare.outputs.datecode }}
  273. merge-multiple: true
  274. - name: Prepare artifacts for upload
  275. run: |
  276. make checksum DATECODE="${{ needs.prepare.outputs.datecode }}"
  277. - name: Upload artifacts
  278. id: upload
  279. uses: actions/upload-artifact@v4
  280. with:
  281. name: void-live-${{ needs.prepare.outputs.datecode }}
  282. path: |
  283. distdir-${{ needs.prepare.outputs.datecode }}/*
  284. if-no-files-found: error
  285. - name: Generate summary
  286. run: |
  287. cat << EOF >> "$GITHUB_STEP_SUMMARY"
  288. ## Images generated successfully!
  289. ### Download
  290. Download the result of this run with \`./release.sh dl ${{ github.run_id }} -- -R ${{ github.repository }}\` or use [this url](${{ steps.upload.outputs.artifact-url }}).
  291. ### Checksums
  292. \`\`\`
  293. $(cat distdir-${{ needs.prepare.outputs.datecode }}/sha256sum.txt)
  294. \`\`\`
  295. EOF