v0.15.3 #120
Workflow file for this run
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: Docker Build and Push to GCR | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [published] | |
# This job uses RafikFarhad's GitHub action to build and | |
# push a docker image to a specified GCP repository | |
jobs: | |
build-and-push-to-gcr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # to get all tags | |
- name: Generate Image Tag | |
id: get-tag | |
run: | | |
REV=$(git rev-list --tags --max-count=1) | |
IMAGE_TAG=$(git describe --tags $REV) | |
echo "IMAGE_TAG=${IMAGE_TAG//v}" | |
echo "IMAGE_TAG=${IMAGE_TAG//v}" >> $GITHUB_OUTPUT | |
- name: Build and Push Image | |
uses: RafikFarhad/push-to-gcr-github-action@v5-beta | |
with: | |
gcloud_service_key: ${{ secrets.JSON_GCLOUD_SERVICE_ACCOUNT_JSON }} # not needed if you use google-github-actions/auth | |
registry: us-central1-docker.pkg.dev | |
project_id: monarch-initiative | |
image_name: monarch-api/monarch-api | |
image_tag: latest, ${{ steps.get-tag.outputs.IMAGE_TAG }} | |
dockerfile: ./backend/Dockerfile | |
# This version uses Google's authentication Action directly, | |
# and makes use of this repository's Makefile. | |
# It currently fails at the push step. | |
# | |
# jobs: | |
# build-and-push-to-gcp: | |
# runs-on: ubuntu-latest | |
# permissions: | |
# contents: 'read' | |
# id-token: 'write' | |
# steps: | |
# - name: Checkout | |
# uses: 'actions/checkout@v3' | |
# - name: 'Authenticate to Google Cloud' | |
# id: 'auth' | |
# uses: 'google-github-actions/auth@v1' | |
# with: | |
# workload_identity_provider: projects/1032453560151/locations/global/workloadIdentityPools/monarch-github-actions/providers/monarch-github-wip | |
# service_account: 'github-actions@monarch-initiative.iam.gserviceaccount.com' | |
# - name: Build and Push to GCP | |
# run: | | |
# pip install poetry | |
# make docker-build | |
# make docker-push |