Skip to content

Commit 1c0e2a4

Browse files
committed
.github/workflows/build.yaml: YYYYMMDD -> YYYYMMDDRN tags
this will prevent cache invalidation issues in the future
1 parent 82d4393 commit 1c0e2a4

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/build.yaml

+15-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ jobs:
3838
- name: Checkout
3939
uses: classabbyamp/treeless-checkout-action@v1
4040

41+
- name: Get image release
42+
id: release
43+
run: |
44+
# gets the list of all date-shaped tags for the image, finds the most recent one
45+
tag="$(skopeo list-tags "docker://ghcr.io/${{ github.repository_owner }}/void-${{ matrix.libc }}${{ matrix.variant }}" | \
46+
jq -r '.Tags | sort | reverse | map(select(test("^[0-9]{8}(R[0-9]+)?$")))[0]')"
47+
# tags from a different day or pre-YYYYMMDDRN
48+
if [ "${tag%R*}" != "$(date -u +%Y%m%d)" ] || [ "${tag%R*}" = "${tag}" ]; then
49+
rel=1
50+
else
51+
rel=$(( ${tag##*R} + 1 ))
52+
fi
53+
echo "rel=${rel}" >> "${GITHUB_OUTPUT}"
54+
4155
- name: Docker metadata
4256
id: meta
4357
uses: docker/metadata-action@v4
@@ -47,7 +61,7 @@ jobs:
4761
tags: |
4862
type=sha,prefix=
4963
type=raw,value=latest,enable={{is_default_branch}}
50-
type=raw,value={{date 'YYYYMMDD'}},enable={{is_default_branch}},priority=1000
64+
type=raw,value={{date 'YYYYMMDD'}}R${{ steps.release.outputs.rel }},enable={{is_default_branch}},priority=1000
5165
flavor: latest=false
5266
labels: |
5367
org.opencontainers.image.authors=Void Linux team and contributors

0 commit comments

Comments
 (0)