2 name: 'Build buildroot containers'
18 group: ${{ github.workflow }}-${{ github.ref }}
19 cancel-in-progress: true
23 runs-on: ubuntu-latest
37 uses: classabbyamp/treeless-checkout-action@v1
39 - name: Get image release
42 # gets the list of all date-shaped tags for the image, finds the most recent one
43 tag="$(skopeo list-tags "docker://ghcr.io/${{ github.repository_owner }}/void-buildroot-${{ matrix.libc }}" | \
44 jq -r '.Tags | sort | reverse | map(select(test("^[0-9]{8}(R[0-9]+)?$")))[0]')"
45 # tags from a different day or pre-YYYYMMDDRN
46 if [ "${tag%R*}" != "$(date -u +%Y%m%d)" ] || [ "${tag%R*}" = "${tag}" ]; then
49 rel=$(( ${tag##*R} + 1 ))
51 echo "rel=${rel}" >> "${GITHUB_OUTPUT}"
53 - name: Docker metadata
55 uses: docker/metadata-action@v4
58 ghcr.io/${{ github.repository_owner }}/void-buildroot-${{ matrix.libc }}
61 type=raw,value=latest,enable={{is_default_branch}}
62 type=raw,value={{date 'YYYYMMDD'}}R${{ steps.release.outputs.rel }},enable={{is_default_branch}},priority=1000
65 org.opencontainers.image.authors=Void Linux team and contributors
66 org.opencontainers.image.url=https://voidlinux.org
67 org.opencontainers.image.documentation=https://github.com/${{ github.repository }}
68 org.opencontainers.image.source=https://github.com/${{ github.repository }}
69 org.opencontainers.image.vendor=Void Linux
70 org.opencontainers.image.title=Void Linux build root
71 org.opencontainers.image.description=Image for building packages with xbps-src on Void Linux
74 uses: docker/setup-qemu-action@v2
76 - name: Set up Docker Buildx
77 uses: docker/setup-buildx-action@v2
80 if: github.event_name != 'pull_request'
81 uses: docker/login-action@v2
84 username: ${{ github.actor }}
85 password: ${{ secrets.GITHUB_TOKEN }}
87 - name: Build and push images
89 uses: docker/bake-action@v3
91 push: ${{ github.event_name != 'pull_request' }}
92 targets: void-buildroot-${{ matrix.libc }}
94 common/container/docker-bake.hcl
95 ${{ steps.meta.outputs.bake-file }}
97 _common.cache-to=type=gha
98 _common.cache-from=type=gha