support force-overwriting Docker image
@@ -7,6 +7,15 @@ on:
paths:
- docker/**
- .github/workflows/docker.yml
+ workflow_dispatch:
+ inputs:
+ tag_name:
+ description: "Tag of the docker image to push"
+ required: true
+ default: "vX.X.X"
+ prerelease:
+ description: "Pre-Release (do not push latest tag)"
+ type: boolean
jobs:
docker-build-push:
@@ -22,13 +31,18 @@ jobs:
- context: "docker/rocm"
base: "cupy/cupy-rocm"
env:
- DOCKER_TAG_NAME: ${{ (github.event_name == 'release' && github.event.release.tag_name) || 'pull-request-test' }}
+ DOCKER_TAG_NAME: |
+ ${{
+ (github.event_name == 'release' && github.event.release.tag_name) ||
+ (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name) ||
+ 'pull-request-test'
+ }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to DockerHub
- if: github.event_name == 'release'
+ if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -39,14 +53,14 @@ jobs:
with:
context: ${{ matrix.context }}
tags: ${{ matrix.base }}:${{ env.DOCKER_TAG_NAME }}
- push: ${{ github.event_name == 'release' }}
+ push: ${{ github.event_name != 'pull_request' }}
- name: Docker Build & Push (latest tag)
if: |
- github.event_name == 'release' &&
- ! github.event.release.prerelease
+ (github.event_name == 'release' && ! github.event.release.prerelease) ||
+ (github.event_name == 'workflow_dispatch' && ! github.event.inputs.prerelease)
uses: docker/build-push-action@v2
with:
context: ${{ matrix.context }}
tags: ${{ matrix.base }}:latest
- push: ${{ github.event_name == 'release' }}
+ push: ${{ github.event_name != 'pull_request' }}
