Skip to content

Instantly share code, notes, and snippets.

@robalb
Created November 17, 2022 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robalb/9184f5eb86109845f8b419912d188160 to your computer and use it in GitHub Desktop.
Save robalb/9184f5eb86109845f8b419912d188160 to your computer and use it in GitHub Desktop.
tag image in github action
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# https://github.com/docker/metadata-action#typesha
tags: |
type=sha,priority=100,format=short,prefix=sha-
type=raw,priority=200,prefix=sha-,value=${{ github.sha }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment