Skip to content

Commit 83bb960

Browse files
authored
Add gh workflow for dockerhub (feast-dev#1098)
* Add gh workflow for dockerhub Signed-off-by: Terence <terencelimxp@gmail.com> * Update workflow Signed-off-by: Terence <terencelimxp@gmail.com> * Update workflow outputs Signed-off-by: Terence <terencelimxp@gmail.com>
1 parent 1c6572a commit 83bb960

File tree

1 file changed

+76
-2
lines changed

1 file changed

+76
-2
lines changed

.github/workflows/release.yml

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,90 @@ jobs:
1010
runs-on: ubuntu-latest
1111
outputs:
1212
release_version: ${{ steps.get_release_version.outputs.release_version }}
13+
version_without_prefix: ${{ steps.get_release_version_without_prefix.outputs.version_without_prefix }}
14+
highest_semver_tag: ${{ steps.get_highest_semver.outputs.highest_semver_tag }}
1315
steps:
1416
- name: Get release version
1517
id: get_release_version
1618
run: echo ::set-output name=release_version::${GITHUB_REF#refs/*/}
19+
- name: Get release version without prefix
20+
id: get_release_version_without_prefix
21+
env:
22+
RELEASE_VERSION: ${{ steps.get_release_version.outputs.release_version }}
23+
run: |
24+
echo ::set-output name=version_without_prefix::${RELEASE_VERSION:1}
25+
- name: Get highest semver
26+
id: get_highest_semver
27+
env:
28+
RELEASE_VERSION: ${{ steps.get_release_version.outputs.release_version }}
29+
run: |
30+
source infra/scripts/setup-common-functions.sh
31+
SEMVER_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$'
32+
if echo "${RELEASE_VERSION}" | grep -P "$SEMVER_REGEX" &>/dev/null ; then
33+
echo ::set-output name=highest_semver_tag::$(get_tag_release -m)
34+
fi
1735
- name: Check output
1836
env:
19-
RELEASE_VERSION: ${{ steps.vars.outputs.release_version }}
37+
RELEASE_VERSION: ${{ steps.get_release_version.outputs.release_version }}
38+
VERSION_WITHOUT_PREFIX: ${{ steps.get_release_version_without_prefix.outputs.version_without_prefix }}
39+
HIGHEST_SEMVER_TAG: ${{ steps.get_highest_semver.outputs.highest_semver_tag }}
2040
run: |
2141
echo $RELEASE_VERSION
22-
echo ${{ steps.vars.outputs.release_version }}
42+
echo $VERSION_WITHOUT_PREFIX
43+
echo $HIGHEST_SEMVER_TAG
44+
45+
build-publish-docker-images:
46+
runs-on: [ubuntu-latest]
47+
needs: get-version
48+
strategy:
49+
matrix:
50+
component: [core, serving, jupyter]
51+
env:
52+
MAVEN_CACHE: gs://feast-templocation-kf-feast/.m2.2020-08-19.tar
53+
DOCKER_BUILDKIT: '1'
54+
steps:
55+
- uses: actions/checkout@v2
56+
- name: Set up QEMU
57+
uses: docker/setup-qemu-action@v1
58+
- name: Set up Docker Buildx
59+
uses: docker/setup-buildx-action@v1
60+
- name: Login to DockerHub
61+
uses: docker/login-action@v1
62+
with:
63+
username: ${{ secrets.DOCKERHUB_USERNAME }}
64+
password: ${{ secrets.DOCKERHUB_TOKEN }}
65+
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
66+
with:
67+
version: '290.0.1'
68+
export_default_credentials: true
69+
- name: Get m2 cache
70+
run: |
71+
infra/scripts/download-maven-cache.sh \
72+
--archive-uri ${MAVEN_CACHE} \
73+
--output-dir .
74+
- name: Build and push
75+
uses: docker/build-push-action@v2
76+
env:
77+
RELEASE_VERSION: ${{ needs.get-version.outputs.release_version }}
78+
with:
79+
push: true
80+
file: infra/docker/${{ matrix.component }}/Dockerfile
81+
tags: feastdev/feast-${{ matrix.component }}:${{ needs.get-version.outputs.release_version }}
82+
build-args: |
83+
REVISION=${RELEASE_VERSION}
84+
- name: Build and push latest
85+
uses: docker/build-push-action@v2
86+
env:
87+
RELEASE_VERSION: ${{ needs.get-version.outputs.release_version }}
88+
VERSION_WITHOUT_PREFIX: ${{ needs.get-version.outputs.version_without_prefix }}
89+
HIGHEST_SEMVER_TAG: ${{ needs.get-version.outputs.highest_semver_tag }}
90+
with:
91+
if: ${VERSION_WITHOUT_PREFIX} == ${HIGHEST_SEMVER_TAG:1}
92+
push: true
93+
file: infra/docker/${{ matrix.component }}/Dockerfile
94+
tags: feastdev/feast-${{ matrix.component }}:latest
95+
build-args: |
96+
REVISION=${RELEASE_VERSION}
2397
2498
publish-helm-charts:
2599
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)