Merge pull request #15 from loadsmart/chore/remove-catalog-info #23
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: datahub-ingestion docker | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- "docs/**" | |
- "**.md" | |
pull_request: | |
branches: | |
- master | |
paths: | |
- "metadata-ingestion/**" | |
- "metadata-models/**" | |
- "docker/datahub-ingestion/**" | |
- ".github/workflows/docker-ingestion.yml" | |
release: | |
types: [published, edited] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.tag.outputs.tag }} | |
publish: ${{ steps.publish.outputs.publish }} | |
python_release_version: ${{ steps.python_release_version.outputs.release_version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Compute Tag | |
id: tag | |
run: | | |
echo "GITHUB_REF: $GITHUB_REF" | |
SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA") | |
TAG=$(echo ${GITHUB_REF} | sed -e "s,refs/heads/master,head\,${SHORT_SHA},g" -e 's,refs/tags/,,g' -e 's,refs/pull/\([0-9]*\).*,pr\1,g') | |
echo "tag=$TAG" >> $GITHUB_OUTPUT | |
- name: Compute Python Release Version | |
id: python_release_version | |
run: | | |
echo "GITHUB_REF: $GITHUB_REF" | |
SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA") | |
RELEASE_VERSION=$(echo ${GITHUB_REF} | sed -e "s,refs/heads/master,0.0.0+docker.${SHORT_SHA},g" -e 's,refs/tags/v\(.*\),\1+docker,g' -e 's,refs/pull/\([0-9]*\).*,0.0.0+docker.pr\1,g') | |
echo "release_version=$RELEASE_VERSION" >> $GITHUB_OUTPUT | |
- name: Check whether publishing enabled | |
id: publish | |
env: | |
ENABLE_PUBLISH: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
echo "Enable publish: ${{ env.ENABLE_PUBLISH != '' }}" | |
echo "publish=${{ env.ENABLE_PUBLISH != '' }}" >> $GITHUB_OUTPUT | |
push_to_registries: | |
name: Build and Push Docker Image to Docker Hub | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Docker meta | |
id: docker_meta | |
uses: crazy-max/ghaction-docker-meta@v1 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
linkedin/datahub-ingestion | |
# add git short SHA as Docker tag | |
tag-custom: ${{ needs.setup.outputs.tag }} | |
tag-custom-only: true | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
if: ${{ needs.setup.outputs.publish == 'true' }} | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and Push image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./docker/datahub-ingestion/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
push: ${{ needs.setup.outputs.publish == 'true' }} | |
build-args: | | |
RELEASE_VERSION=${{ needs.setup.outputs.python_release_version }} |