DockerHub deployment (*)

if secrets.DOCKERHUB_USERNAME and secrets.DOCKERHUB_PASSWORD are non-empty
This commit is contained in:
Robin C. Ladiges 2022-04-08 19:29:00 +02:00
parent 43ab276554
commit de68132972
No known key found for this signature in database
GPG Key ID: D2A51CCB004EFBCE

View File

@ -113,12 +113,14 @@ jobs:
name: Environment name: Environment
run : | run : |
echo IMAGE=$(echo ${{ env.IMAGE }} | tr '[:upper:]' '[:lower:]') >>$GITHUB_ENV echo IMAGE=$(echo ${{ env.IMAGE }} | tr '[:upper:]' '[:lower:]') >>$GITHUB_ENV
echo DOCKERHUB_IMAGE=$([ "${{ secrets.DOCKERHUB_USERNAME }}" != '' ] && [ "${{ secrets.DOCKERHUB_PASSWORD }}" != "" ] && echo "$IMAGE") >>$GITHUB_ENV
- -
name: Docker meta name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v3 uses: docker/metadata-action@v3
with: with:
images: | images: |
${{ env.DOCKERHUB_IMAGE }}
ghcr.io/${{ env.IMAGE }} ghcr.io/${{ env.IMAGE }}
tags: | tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
@ -131,6 +133,13 @@ jobs:
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
if: ${{ env.DOCKERHUB_IMAGE != '' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- -
name: Login to GHCR name: Login to GHCR
uses: docker/login-action@v1 uses: docker/login-action@v1