Skip to content

Commit

Permalink
.github/workflows/build.yaml: YYYYMMDD -> YYYYMMDDRN tags
Browse files Browse the repository at this point in the history
this will prevent cache invalidation issues in the future
  • Loading branch information
classabbyamp committed Aug 17, 2023
1 parent 82d4393 commit 1c0e2a4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ jobs:
- name: Checkout
uses: classabbyamp/treeless-checkout-action@v1

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

0 comments on commit 1c0e2a4

Please sign in to comment.