Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 22 additions & 35 deletions .github/workflows/push-docker.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
name: Build and publish to Docker Hub
name: Build and publish to GHCR

on:
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
inputs:
image_base_name:
required: true
Expand All @@ -19,55 +14,47 @@ on:
required: true
type: string
checkout_submodules:
description: Forwarded to `submodule` input of the `actions/checkout` step.
type: boolean
required: false
# Default: false
# See: https://github.com/actions/checkout/tree/v2
default: false

jobs:
push-docker:
name: Push docker @ ${{ inputs.tag_value }}
name: Push Docker Image to GHCR @ ${{ inputs.tag_value }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
submodules: ${{ inputs.checkout_submodules }}

- name: Echo Deprecation Warning
run: |
echo "::warning Deprecated action. Migrate to branch_ci.yml and tagged_ci.yml"

- name: Echo Deprecation Warning
run: |
echo "::warning Deprecated action. Migrate to branch_ci.yml and tagged_ci.yml"

- name: Checkout
uses: actions/checkout@v2
with:
# Using `main` because so far this has always been done *after* a bump-version, which adds
# a commit on top of the default commit to which the action would be otherwise pointing.
ref: main
submodules: ${{ inputs.checkout_submodules }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
# TODO make more flexible
images: |
openclimatefix/${{ inputs.image_base_name }}
tags: |
type=raw,value=${{ inputs.tag_value }}
flavor: |
latest=true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1

- name: Generate Docker Image Metadata
id: meta
uses: docker/metadata-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
images: ghcr.io/openclimatefix/${{ inputs.image_base_name }}
tags: type=raw,value=${{ inputs.tag_value }}
flavor: latest=true

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: openclimatefix
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push

- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
Expand Down