build and publish docker images #7
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: build and publish docker images | |
on: | |
workflow_dispatch: # Allows manual trigger of the workflow | |
inputs: | |
custom_version: # Optional input for a custom version | |
description: 'Custom version to publish (e.g., v1.2.3) -- only edit if you know what you are doing' | |
required: false | |
token: | |
description: 'Personal Access Token' | |
required: true | |
default: "" | |
type: string | |
workflow_call: # Allows trigger of the workflow from another workflow | |
inputs: | |
custom_version: # Optional input for a custom version | |
description: 'Custom version to publish (e.g., v1.2.3) -- only edit if you know what you are doing' | |
required: false | |
type: string | |
token: | |
description: 'Personal Access Token' | |
required: true | |
default: "" | |
type: string | |
jobs: | |
build-publish-docker-images: | |
if: github.repository == 'feast-dev/feast' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
component: [ feature-server, feature-server-java, feature-transformation-server, feast-helm-operator, feast-operator ] | |
env: | |
MAVEN_CACHE: gs://feast-templocation-kf-feast/.m2.2020-08-19.tar | |
REGISTRY: quay.io/feastdev | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- id: get-version | |
uses: ./.github/actions/get-semantic-release-version | |
with: | |
custom_version: ${{ github.event.inputs.custom_version }} | |
token: ${{ github.event.inputs.token }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
- name: Login to Quay.io | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAYIO_USERNAME }} | |
password: ${{ secrets.QUAYIO_TOKEN }} | |
- name: Authenticate to Google Cloud | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ secrets.GCP_SA_KEY }}' | |
- name: Set up gcloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
- name: Use gcloud CLI | |
run: gcloud info | |
- run: gcloud auth configure-docker --quiet | |
- name: Build image | |
env: | |
VERSION_WITHOUT_PREFIX: ${{ steps.get-version.outputs.version_without_prefix }} | |
run: | | |
make build-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${VERSION_WITHOUT_PREFIX} | |
- name: Push versioned images | |
env: | |
VERSION_WITHOUT_PREFIX: ${{ steps.get-version.outputs.version_without_prefix }} | |
HIGHEST_SEMVER_TAG: ${{ steps.get-version.outputs.highest_semver_tag }} | |
run: | | |
make push-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${VERSION_WITHOUT_PREFIX} | |
echo "Only push to latest tag if tag is the highest semver version $HIGHEST_SEMVER_TAG" | |
if [ "${VERSION_WITHOUT_PREFIX}" = "${HIGHEST_SEMVER_TAG:1}" ] | |
then | |
docker tag ${REGISTRY}/${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} ${REGISTRY}/${{ matrix.component }}:latest | |
docker push ${REGISTRY}/${{ matrix.component }}:latest | |
fi |