Skip to content

Commit

Permalink
GitHub/Workflow: Update docker-metadata-tags
Browse files Browse the repository at this point in the history
- query the latest released version
- create new patch version or increment latest patch version

Signed-off-by: Andras Mitzki <andras.mitzki@axoflow.com>
  • Loading branch information
Andras Mitzki committed Dec 9, 2024
1 parent 62228cd commit 1aa9983
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/axosyslog-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ jobs:
merge-and-push:
runs-on: ubuntu-latest
needs: [prepare, image-build]
outputs:
tags: ${{ steps.docker-metadata-tags.outputs.tags }}
steps:
- name: Download digests
uses: actions/download-artifact@v4
Expand All @@ -149,13 +151,21 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract metadata (AxoSyslog version) for Docker
id: docker-metadata-tags
uses: docker/metadata-action@v5
with:
images: ${{ needs.prepare.outputs.image-name }}
tags: type=match,pattern=axosyslog-([0-9].*),group=1
sep-tags: ','
- id: docker-metadata-tags
name: Extract metadata (AxoSyslog version) for Docker
run: |
last_full_version=$(skopeo inspect docker://ghcr.io/axoflow/axosyslog:latest | jq '.RepoTags' | sed 's/ \|"\|,//g' | grep "^[0-9]*.[0-9]*.[0-9]*$\|^[0-9]*.[0-9]*.[0-9]*-[0-9]*$" | tail -n 1)
if [[ $last_full_version == *"-"* ]]; then
last_version=$(echo $last_full_version | cut -d"-" -f1)
last_patch_level=$(echo $last_full_version | cut -d"-" -f2)
next_patch_level=$((last_patch_level + 1))
else
last_version=$(echo $last_full_version | cut -d"-" -f1)
next_patch_level=1
fi
next_full_version="$last_version-$next_patch_level"
TAGS="ghcr.io/axoflow/axosyslog:$last_version,ghcr.io/axoflow/axosyslog:$next_full_version,ghcr.io/axoflow/axosyslog:latest"
echo "tags=$TAGS" >> $GITHUB_OUTPUT
- name: Compose Docker image tags
id: tags
Expand Down

0 comments on commit 1aa9983

Please sign in to comment.