Publish Docker image to GitHub Container Registry

This commit is contained in:
JonnyWong16 2020-10-29 21:44:27 -07:00
commit ac24acf9ce
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -49,13 +49,21 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-buildx- ${{ runner.os }}-buildx-
- name: Docker Login - name: Login to DockerHub
uses: docker/login-action@v1 uses: docker/login-action@v1
if: success() if: success()
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
if: success()
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Docker Build and Push - name: Docker Build and Push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
if: success() if: success()
@ -69,15 +77,12 @@ jobs:
BRANCH=${{ steps.prepare.outputs.branch }} BRANCH=${{ steps.prepare.outputs.branch }}
COMMIT=${{ steps.prepare.outputs.commit }} COMMIT=${{ steps.prepare.outputs.commit }}
BUILD_DATE=${{ steps.prepare.outputs.build_date }} BUILD_DATE=${{ steps.prepare.outputs.build_date }}
tags: ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.tag }} tags: |
${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.tag }}
ghcr.io/${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.tag }}
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
- name: Clear
if: always()
run: |
rm -f ${HOME}/.docker/config.json
- name: Post Status to Discord - name: Post Status to Discord
uses: sarisia/actions-status-discord@v1 uses: sarisia/actions-status-discord@v1
if: always() if: always()