allow build of prereq docker image on forks (#209)

* push to GITHUB_ACTOR in Docker Hub

* forcing change to cause rebuild

* ditto

* add docker hub secret

* ditto

* ditto

* ditto

* add comment

* differentiate between master and fork

Co-authored-by: Alexandre Eichenberger <alexe@us.ibm.com>
This commit is contained in:
Kevin O'Brien 2020-07-07 12:42:05 -04:00 committed by GitHub
parent 8e6642b2bc
commit 0d375dd75e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 2 deletions

View File

@ -2,6 +2,10 @@
# It will create a new Docker image for the TravisCI build and push it to Docker Hub # It will create a new Docker image for the TravisCI build and push it to Docker Hub
# This image contains the prereqs for building onnx-mlir including a precompiled copy of the appropriate # This image contains the prereqs for building onnx-mlir including a precompiled copy of the appropriate
# LLVM and MLIR code. # LLVM and MLIR code.
#
# To make this work on your fork you need to enable the github workflow and set a personal access token for your
# docker hub account in the github secrets.
# When the action succeeds it will put the prereq image in your docker hub repository.
name: Build Docker Prereq Image name: Build Docker Prereq Image
@ -21,7 +25,16 @@ jobs:
steps: steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: build image - name: build image on fork
if: ! endsWith(github.ref, '/master')
env:
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
run: |
docker build --tag $GITHUB_ACTOR/onnx-mlir-llvmimage:initial -f $GITHUB_WORKSPACE/.github/workflows/prereq.Dockerfile $GITHUB_WORKSPACE/utils
docker login -u $GITHUB_ACTOR -p "$DOCKER_HUB_TOKEN"
docker push $GITHUB_ACTOR/onnx-mlir-llvmimage:initial
- name: build image on master
if: endsWith(github.ref, '/master')
run: | run: |
docker build --tag onnxmlirczar/onnx-mlir-llvmimage:initial -f $GITHUB_WORKSPACE/.github/workflows/prereq.Dockerfile $GITHUB_WORKSPACE/utils docker build --tag onnxmlirczar/onnx-mlir-llvmimage:initial -f $GITHUB_WORKSPACE/.github/workflows/prereq.Dockerfile $GITHUB_WORKSPACE/utils
docker login -u onnxmlirczar -p 143f1da2-332f-45a1-8587-d6cb07c13230 docker login -u onnxmlirczar -p 143f1da2-332f-45a1-8587-d6cb07c13230