forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 12
76 lines (75 loc) · 2.61 KB
/
docker-airflow-acryl.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: datahub-airflow docker acryl
on:
workflow_run:
workflows: ["pypi-release"]
types:
- completed
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@v4
- name: Validate ref format
run: |
source .github/scripts/docker_helpers.sh
validate_github_ref_for_python_tag
- 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/tags/,,g')
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Check whether publishing enabled
id: publish
env:
ENABLE_PUBLISH: ${{ secrets.ORG_DOCKER_PASSWORD }}
run: |
echo "Enable publish: ${{ env.ENABLE_PUBLISH != '' }}"
echo "${{ env.ENABLE_PUBLISH != '' }}" >> $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/tags/v,,g')
echo "release_version=$RELEASE_VERSION" >> $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@v4
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: |
acryldata/datahub-airflow
# add git short SHA as Docker tag
tag-custom: ${{ needs.setup.outputs.tag }}
tag-custom-only: true
- name: Login to DockerHub
if: ${{ needs.setup.outputs.publish == 'true' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.ORG_DOCKER_PASSWORD }}
- name: Build and Push image
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/airflow/Dockerfile
tags: ${{ steps.docker_meta.outputs.tags }}
push: ${{ needs.setup.outputs.publish == 'true' }}
build-args: |
RELEASE_VERSION=${{ needs.setup.outputs.python_release_version }}