Skip to content

Commit

Permalink
Update docker.yml to optionally upload to DockerHub
Browse files Browse the repository at this point in the history
  • Loading branch information
tillrohrmann committed Nov 27, 2023
1 parent bf04449 commit a49e55e
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
required: false
default: false
type: boolean
uploadToDockerHub:
description: 'upload image to DockerHub'
required: false
default: false
type: boolean

workflow_dispatch:
inputs:
Expand All @@ -26,10 +31,13 @@ on:
required: false
default: false
type: boolean
uploadToDockerHub:
description: 'upload image to DockerHub'
required: false
default: false
type: boolean

env:
REGISTRY: 'ghcr.io'
REPOSITORY: ${{ github.repository_owner }}
REGISTRY_USERNAME: ${{ github.actor }}
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -61,11 +69,18 @@ jobs:
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}" >> $GITHUB_ENV
- name: Print image names
run: |
echo ${{ inputs.uploadToDockerHub && format('restatedev/{0}', env.IMAGE_NAME) || '' }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}/${{ env.IMAGE_NAME }}
images: |
ghcr.io/restatedev/${{ env.IMAGE_NAME }}
${{ inputs.uploadToDockerHub && format('restatedev/{0}', env.IMAGE_NAME) || '' }}
# Note: We need this to generate the latest tag until we have a first stable release.
# Check https://github.com/docker/metadata-action/issues/34
flavor: |
Expand Down

0 comments on commit a49e55e

Please sign in to comment.