Skip to content

Commit 945b52b

Browse files
committed
feat: add GHCR as a registry
1 parent 40feb2c commit 945b52b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/docker-publish.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,24 @@ jobs:
4646
username: ${{ secrets.DOCKER_USERNAME }}
4747
password: ${{ secrets.DOCKER_PASSWORD }}
4848

49-
# Extract metadata (tags, labels) for Docker
49+
# Login to GitHub Container Registry
50+
- name: Log in to GHCR
51+
if: github.event_name != 'pull_request'
52+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
53+
with:
54+
registry: ghcr.io
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
58+
# Extract metadata (tags, labels) for both registires
5059
# https://github.com/docker/metadata-action
5160
- name: Extract Docker metadata
5261
id: meta
5362
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
5463
with:
55-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
64+
images: |
65+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
66+
${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}
5667
tags: |
5768
type=raw,value=latest,enable={{is_default_branch}}
5869
type=semver,pattern={{version}}

0 commit comments

Comments
 (0)