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 ref: description: 'Git ref to checkout (branch, tag, or SHA). Defaults to the triggering ref. Use to rebuild images from a different branch (e.g., master) when the release tag has a broken Dockerfile.' required: false 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-transformation-server, feast-operator, go-feature-server ] env: MAVEN_CACHE: gs://feast-templocation-kf-feast/.m2.2020-08-19.tar REGISTRY: quay.io/feastdev steps: - uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.ref || github.ref }} 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@v2' with: credentials_json: '${{ secrets.GCP_SA_KEY }}' - name: Set up gcloud SDK uses: google-github-actions/setup-gcloud@v2 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: | if [ "${{ matrix.component }}" = "feature-server" ]; then make build-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${VERSION_WITHOUT_PREFIX} DOCKER_PUSH=true DOCKER_PLATFORMS=linux/amd64,linux/arm64 else make build-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${VERSION_WITHOUT_PREFIX} fi - 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: | if [ "${{ matrix.component }}" = "feature-server" ]; then echo "feature-server image pushed via buildx during build step" else make push-${{ matrix.component }}-docker REGISTRY=${REGISTRY} VERSION=${VERSION_WITHOUT_PREFIX} fi 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 if [ "${{ matrix.component }}" = "feature-server" ]; then docker buildx imagetools create -t ${REGISTRY}/feature-server:latest ${REGISTRY}/feature-server:${VERSION_WITHOUT_PREFIX} else docker tag ${REGISTRY}/${{ matrix.component }}:${VERSION_WITHOUT_PREFIX} ${REGISTRY}/${{ matrix.component }}:latest docker push ${REGISTRY}/${{ matrix.component }}:latest fi fi