Skip to content

Commit 0b05aea

Browse files
authored
Merge pull request #10 from uyjulian/ghcr_upload
Upload containers to Github Container Registry
2 parents df67b94 + a703ba0 commit 0b05aea

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

.github/workflows/docker.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,28 @@ jobs:
4141
username: ${{ secrets.DOCKER_USERNAME }}
4242
password: ${{ secrets.DOCKER_PASSWORD }}
4343

44-
- uses: docker/build-push-action@v2
44+
- name: Login to Github Container Registry
45+
uses: docker/login-action@v1
46+
with:
47+
registry: ghcr.io
48+
username: ${{ github.actor }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Set docker tag list to include DockerHub if credentials available
4552
if: env.DOCKER_USERNAME != null
53+
run: |
54+
echo "DOCKER_TAG_LIST=ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }},${{ github.repository }}:${{ env.DOCKER_TAG }}" >> $GITHUB_ENV
55+
56+
- name: Set docker tag list to not include DockerHub if credentials not available
57+
if: env.DOCKER_USERNAME == null
58+
run: |
59+
echo "DOCKER_TAG_LIST=ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }}" >> $GITHUB_ENV
60+
61+
- name: Build and Push to container registry
62+
uses: docker/build-push-action@v2
4663
with:
4764
push: true
48-
tags: ${{ github.repository }}:${{ env.DOCKER_TAG }}
65+
tags: ${{ env.DOCKER_TAG_LIST }}
4966

5067
- name: Send Compile action
5168
run: |

0 commit comments

Comments
 (0)