Skip to content

Commit

Permalink
Merge pull request #3 from classabbyamp/rel-tags
Browse files Browse the repository at this point in the history
.github/workflows/build.yaml: add Rn to date tags
  • Loading branch information
Duncaen authored Aug 18, 2023
2 parents 5642a47 + 31481c9 commit 18ac7af
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 @@ -32,6 +32,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 }}" | \
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 @@ -41,7 +55,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.source=https://github.com/${{ github.repository }}
Expand Down

0 comments on commit 18ac7af

Please sign in to comment.