datahub/.github/workflows/docker-mce-consumer.yml
John Plaisted 5d394c6062
build: fix docker actions. (#1787)
* bug: Fix docker actions.

We renamed directories in docker/ which broke the actions.

Also try to refactor the action files a little so that we can run (but not publish) these images on pull requests that change the docker/ dir as an extra check. Note this only seems to be supported by the dockerhub plugin; the github plugin doesn't support this (so that will be an issue when we move to it only).

* Drop extra pipes
2020-08-07 19:15:09 -07:00

71 lines
2.1 KiB
YAML

name: datahub-mce-consumer docker
on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
- '**.md'
pull_request:
branches:
- master
paths:
- 'docker/**'
- '.github/workflows/docker-mce-consumer.yml'
paths_ignore:
- '**.md'
- '**.env'
release:
types: [published, edited]
jobs:
setup:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
publish: ${{ steps.publish.outputs.publish }}
steps:
- uses: actions/checkout@v2
- id: tag
run: |
echo "GITHUB_REF: $GITHUB_REF"
TAG=$(echo ${GITHUB_REF} | sed -e 's,refs/heads/master,latest,g' -e 's,refs/tags/,,g' -e 's,refs/pull/\([0-9]*\).*,pr\1,g')
echo "tag=$TAG"
echo "::set-output name=tag::$TAG"
- name: Check whether publishing enabled
id: publish
env:
ENABLE_PUBLISH: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "Enable publish: ${{ env.ENABLE_PUBLISH != '' }}"
echo "::set-output name=publish::${{ env.ENABLE_PUBLISH != '' }}"
build-and-publish-dockerhub:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v2
- uses: docker/build-push-action@v1
env:
DOCKER_BUILDKIT: 1
with:
dockerfile: ./docker/datahub-mce-consumer/Dockerfile
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: linkedin/datahub-mce-consumer
tags: ${{ needs.setup.outputs.tag }}
push: ${{ needs.setup.outputs.publish == 'true' }}
build-and-publish-github:
runs-on: ubuntu-latest
if: ${{ needs.setup.outputs.publish == 'true' }}
needs: setup
steps:
- uses: actions/checkout@v2
- uses: VaultVulp/gp-docker-action@1.1.6
env:
DOCKER_BUILDKIT: 1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: ./docker/datahub-mce-consumer/Dockerfile
image-name: datahub-mce-consumer
image-tag: ${{ needs.setup.outputs.tag }}