Publish Turing Docker Image #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: Tag for release | ||
required: true | ||
draft: | ||
description: "in draft mode, we won't update the lastest tag" | ||
type: boolean | ||
required: true | ||
default: 'true' | ||
jobs: | ||
build-docker: | ||
Check failure on line 16 in .github/workflows/build-docker.yml GitHub Actions / Publish Docker ReleaseInvalid workflow file
|
||
name: Build and Publis to Docker Hub | ||
runs-on: ubuntu-latest | ||
needs: build-binary | ||
steps: | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.inputs.tag }} | ||
- name: Download binary | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: oak-collator | ||
# In draft mode we will push to below tag: | ||
# reponame/imagename:{{git_revision}} | ||
# reponame/imagename:{{tag}}-{{git_revision}} | ||
# so we will have image such as | ||
# oaknetwork/turing:abcdef | ||
# oaknetwork/turing:2.0.0-abcdef | ||
# | ||
# and we can test these image | ||
- name: Build | ||
run: | | ||
tag=${{ github.event.inputs.tag }} | ||
docker build -f ./docker/turing/Dockerfile -t oaknetwork/turing:${GITHUB_SHA} . | ||
docker push oaknetwork/turing:${GITHUB_SHA} | ||
docker_tag="${tag:1}" | ||
docker tag oaknetwork/turing:${GITHUB_SHA} oaknetwork/turing:${docker_tag} | ||
docker push oaknetwork/turing:$docker_tag | ||
# when not in draft mode, we will update the pointer tag | ||
# so we will have image such as | ||
# oaknetwork/turing:latest | ||
# oaknetwork/turing:2.0.0 | ||
- name: Push latest tag to docker hub | ||
run: | | ||
# TODO : remove echo after test | ||
echo docker tag oaknetwork/turing:${GITHUB_SHA} oaknetwork/turing:${docker_tag} | ||
echo docker push oaknetwork/turing:$docker_tag | ||
echo docker tag oaknetwork/turing:$docker_tag oaknetwork/turing:latest | ||
echo docker push oaknetwork/turing:latest | ||
if: ${{ inputs.draft == false }} |