Skip to content

Commit 750d07d

Browse files
authored
Merge pull request #557 from dundring/push-image-to-ghcr
Push image to GitHub Container Registry (ghcr.io)
2 parents ee4b699 + 1c102cb commit 750d07d

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/build-and-push.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
permissions:
88
contents: write
9+
packages: write
910

1011
jobs:
1112
build:
@@ -28,11 +29,12 @@ jobs:
2829
id: gitversion
2930
uses: gittools/actions/gitversion/execute@v3
3031

31-
- name: Login to Docker Hub
32+
- name: Login to GitHub Container Registry
3233
uses: docker/login-action@v3
3334
with:
34-
username: ${{ vars.DOCKERHUB_USERNAME }}
35-
password: ${{ secrets.DOCKERHUB_TOKEN }}
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
3638

3739
- name: Set up Docker Buildx
3840
uses: docker/setup-buildx-action@v3
@@ -41,7 +43,9 @@ jobs:
4143
uses: docker/build-push-action@v6
4244
with:
4345
file: ./Dockerfile
44-
tags: ${{ vars.DOCKERHUB_USERNAME }}/dundring-trainer:${{ steps.gitversion.outputs.semVer }}
46+
tags: |
47+
ghcr.io/dundring/trainer:${{ steps.gitversion.outputs.semVer }}
48+
ghcr.io/dundring/trainer:latest
4549
push: true
4650

4751
- name: Set version tag

0 commit comments

Comments
 (0)