Skip to content

Commit

Permalink
ci(docker): workflow docker image tag
Browse files Browse the repository at this point in the history
  • Loading branch information
arhamj committed Oct 21, 2024
1 parent 5199f18 commit ae14a13
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,20 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ github.ref_name }}-${{ github.sha }}
type=sha,format=short
- name: Get short commit hash
id: get-short-hash
run: echo "SHORT_COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-${{ env.SHORT_COMMIT_HASH }}
labels: |
version=${{ env.SHORT_COMMIT_HASH }}
branch=${{ github.ref_name }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
Expand Down

0 comments on commit ae14a13

Please sign in to comment.