gen-images.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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-glibc-full:20231230R1'
  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: |
  113. # Switch to mirror
  114. mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
  115. sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
  116. /etc/xbps.d/*-repository-*.conf
  117. xbps-install -Syu xbps && xbps-install -yu
  118. xbps-install -yu bash make git kmod xz lzo qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
  119. - name: Clone and checkout
  120. uses: classabbyamp/treeless-checkout-action@v1
  121. - name: Build live ISOs
  122. run: |
  123. make live-iso-all-print live-iso-all \
  124. SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
  125. DATECODE="${{ needs.prepare.outputs.datecode }}" \
  126. LIVE_ARCHS="${{ matrix.arch }}" LIVE_FLAVORS="${{ matrix.flavor }}"
  127. - name: Prepare artifacts for upload
  128. run: |
  129. make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
  130. - name: Upload artifacts
  131. uses: actions/upload-artifact@v4
  132. with:
  133. name: void-iso-${{ matrix.arch }}-${{ matrix.flavor }}-${{ needs.prepare.outputs.datecode }}
  134. path: |
  135. distdir-${{ needs.prepare.outputs.datecode }}/*
  136. if-no-files-found: error
  137. build-rootfs:
  138. name: Build ROOTFSes
  139. runs-on: ubuntu-latest
  140. needs: prepare
  141. if: ${{ inputs.rootfs_flag }}
  142. strategy:
  143. matrix:
  144. arch: ${{ fromJson(needs.prepare.outputs.rootfs) }}
  145. container:
  146. image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
  147. options: --privileged
  148. volumes:
  149. - /dev:/dev
  150. env:
  151. PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
  152. MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
  153. steps:
  154. - name: Prepare container
  155. shell: sh
  156. run: |
  157. # Switch to mirror
  158. mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
  159. sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
  160. /etc/xbps.d/*-repository-*.conf
  161. xbps-install -Syu xbps && xbps-install -yu
  162. xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
  163. - name: Clone and checkout
  164. uses: classabbyamp/treeless-checkout-action@v1
  165. - name: Build ROOTFSes
  166. run: |
  167. make rootfs-all-print rootfs-all \
  168. SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
  169. DATECODE="${{ needs.prepare.outputs.datecode }}" \
  170. ARCHS="${{ matrix.arch }}"
  171. - name: Prepare artifacts for upload
  172. run: |
  173. make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
  174. - name: Upload artifacts
  175. uses: actions/upload-artifact@v4
  176. with:
  177. name: void-rootfs-${{ matrix.arch }}-${{ needs.prepare.outputs.datecode }}
  178. path: |
  179. distdir-${{ needs.prepare.outputs.datecode }}/*
  180. if-no-files-found: error
  181. build-platformfs:
  182. name: Build PLATFORMFSes
  183. runs-on: ubuntu-latest
  184. needs: prepare
  185. if: ${{ inputs.platformfs_flag }}
  186. strategy:
  187. matrix:
  188. platform: ${{ fromJson(needs.prepare.outputs.platformfs) }}
  189. container:
  190. image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
  191. options: --privileged
  192. volumes:
  193. - /dev:/dev
  194. env:
  195. PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
  196. MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
  197. steps:
  198. - name: Prepare container
  199. shell: sh
  200. run: |
  201. # Switch to mirror
  202. mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
  203. sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
  204. /etc/xbps.d/*-repository-*.conf
  205. xbps-install -Syu xbps && xbps-install -yu
  206. xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
  207. - name: Clone and checkout
  208. uses: classabbyamp/treeless-checkout-action@v1
  209. - name: Build PLATFORMFSes
  210. run: |
  211. make platformfs-all-print platformfs-all \
  212. SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
  213. DATECODE="${{ needs.prepare.outputs.datecode }}" \
  214. PLATFORMS="${{ matrix.platform }}"
  215. - name: Prepare artifacts for upload
  216. run: |
  217. make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
  218. - name: Upload artifacts
  219. uses: actions/upload-artifact@v4
  220. with:
  221. name: void-platformfs-${{ matrix.platform }}-${{ needs.prepare.outputs.datecode }}
  222. path: |
  223. distdir-${{ needs.prepare.outputs.datecode }}/*
  224. !distdir-${{ needs.prepare.outputs.datecode }}/*ROOTFS*
  225. if-no-files-found: error
  226. build-sbc-img:
  227. name: Build SBC Images
  228. runs-on: ubuntu-latest
  229. needs: prepare
  230. if: ${{ inputs.sbc_img_flag }}
  231. strategy:
  232. matrix:
  233. platform: ${{ fromJson(needs.prepare.outputs.sbc_imgs) }}
  234. container:
  235. image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
  236. options: --privileged
  237. volumes:
  238. - /dev:/dev
  239. env:
  240. PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
  241. MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
  242. steps:
  243. - name: Prepare container
  244. shell: sh
  245. run: |
  246. # Switch to mirror
  247. mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
  248. sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
  249. /etc/xbps.d/*-repository-*.conf
  250. xbps-install -Syu xbps && xbps-install -yu
  251. xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
  252. - name: Clone and checkout
  253. uses: classabbyamp/treeless-checkout-action@v1
  254. - name: Build SBC Images
  255. run: |
  256. make images-all-sbc-print images-all-sbc \
  257. SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
  258. DATECODE="${{ needs.prepare.outputs.datecode }}" \
  259. SBC_IMGS="${{ matrix.platform }}"
  260. - name: Prepare artifacts for upload
  261. run: |
  262. make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
  263. - name: Upload artifacts
  264. uses: actions/upload-artifact@v4
  265. with:
  266. name: void-sbc-img-${{ matrix.platform }}-${{ needs.prepare.outputs.datecode }}
  267. path: |
  268. distdir-${{ needs.prepare.outputs.datecode }}/*
  269. !distdir-${{ needs.prepare.outputs.datecode }}/*ROOTFS*
  270. !distdir-${{ needs.prepare.outputs.datecode }}/*PLATFORMFS*
  271. if-no-files-found: error
  272. merge-artifacts:
  273. name: Combine artifacts
  274. runs-on: ubuntu-latest
  275. if: ${{ always() }}
  276. needs:
  277. - prepare
  278. - build-live-isos
  279. - build-rootfs
  280. - build-platformfs
  281. - build-sbc-img
  282. container:
  283. image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
  284. env:
  285. PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
  286. MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
  287. steps:
  288. - name: Prepare container
  289. shell: sh
  290. run: |
  291. # Switch to mirror
  292. mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
  293. sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
  294. /etc/xbps.d/*-repository-*.conf
  295. # Sync and upgrade once, assume error comes from xbps update
  296. xbps-install -Syu || xbps-install -yu xbps
  297. # Upgrade again (in case there was a xbps update)
  298. xbps-install -yu
  299. # Install depedencies
  300. xbps-install -yu bash make git outils
  301. - name: Clone and checkout
  302. uses: classabbyamp/treeless-checkout-action@v1
  303. - name: Download artifacts
  304. uses: actions/download-artifact@v4
  305. with:
  306. path: distdir-${{ needs.prepare.outputs.datecode }}
  307. merge-multiple: true
  308. - name: Prepare artifacts for upload
  309. run: |
  310. make checksum DATECODE="${{ needs.prepare.outputs.datecode }}"
  311. - name: Upload artifacts
  312. id: upload
  313. uses: actions/upload-artifact@v4
  314. with:
  315. name: void-live-${{ needs.prepare.outputs.datecode }}
  316. path: |
  317. distdir-${{ needs.prepare.outputs.datecode }}/*
  318. if-no-files-found: error
  319. - name: Generate summary
  320. run: |
  321. cat << EOF >> "$GITHUB_STEP_SUMMARY"
  322. ## Images generated successfully!
  323. ### Download
  324. 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 }}).
  325. ### Checksums
  326. \`\`\`
  327. $(cat distdir-${{ needs.prepare.outputs.datecode }}/sha256sum.txt)
  328. \`\`\`
  329. EOF