Skip to content

Commit c92ae9b

Browse files
authored
Use docker/metadata-action to Tag Docker Images (#186)
Instead of our own logic to tag the Docker images, we are now using the `docker/metadata-action` GitHub Action. See https://github.com/docker/metadata-action
1 parent 65503f5 commit c92ae9b

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

.github/workflows/continuous-delivery-docker.yaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@ jobs:
1919
with:
2020
fetch-depth: 0
2121

22-
- name: Set Docker Tag
23-
id: tag
24-
run: |
25-
if [[ $GITHUB_REF == refs/tags/* ]]; then
26-
echo TAG=${GITHUB_REF:10} >> $GITHUB_ENV
27-
else
28-
echo TAG=main >> $GITHUB_ENV
29-
fi
22+
- name: Docker Metadata
23+
id: metadata
24+
uses: docker/metadata-action@v5
25+
with:
26+
images: |
27+
ghcr.io/${{ github.repository }}
28+
ricoberger/script_exporter
29+
tags: |
30+
type=ref,event=branch
31+
type=semver,pattern={{raw}}
3032
3133
- name: Set up QEMU
3234
uses: docker/setup-qemu-action@v3
@@ -57,9 +59,8 @@ jobs:
5759
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8
5860
cache-from: type=gha
5961
cache-to: type=gha,mode=max
60-
tags: |
61-
ghcr.io/${{ github.repository }}:${{ env.TAG }}
62-
ricoberger/script_exporter:${{ env.TAG }}
62+
tags: ${{ steps.metadata.outputs.tags }}
63+
labels: ${{ steps.metadata.outputs.labels }}
6364

6465
helm:
6566
name: Helm

0 commit comments

Comments
 (0)