# This is needed to push to GitHub Container Registry. See https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
permissions:
contents:read
packages:write
jobs:
build:
runs-on:ubuntu-latest
steps:
- name:Checkout
uses:actions/checkout@v3
# This step generates the docker tags
- name:Docker meta
id:meta
uses:docker/metadata-action@v4
env:
# This env var ensures {{sha}} is a real commit SHA for type=ref,event=pr
DOCKER_METADATA_PR_HEAD_SHA:'true'
with:
images:|
${{ github.repository }}
ghcr.io/${{ github.repository }}
# type=ref,event=branch generates tag(s) on branch only. E.g. 'master', 'master-abc0123'
# type=ref,event=tag generates tag(s) on tags only. E.g. 'v0.0.0', 'v0.0.0-abc0123', and 'latest'
tags:|
type=ref,suffix=-{{sha}},event=pr
type=ref,event=branch
type=ref,suffix=-{{sha}},event=branch
type=ref,event=tag
type=ref,suffix=-{{sha}},event=tag
# The rest of the org.opencontainers.image.xxx labels are dynamically generated