Merge pull request #192 from broadinstitute/sn_POD-2367_remove_rsync #224
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 Push Docker images to Google Artifact Registry (GAR) | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GCP | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.OPS_ARTIFACT_REGISTRY_SVC_ACCOUNT }} | |
- name: Configure Docker to use the Google Artifact Registry | |
run: gcloud auth configure-docker us-central1-docker.pkg.dev | |
- name: Build and Push Docker Images | |
run: | | |
docker build -t us-central1-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/ops_terra_utils_slim:$GITHUB_SHA -f ./ops_docker_utils_slim/Dockerfile . | |
docker push us-central1-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/ops_terra_utils_slim:$GITHUB_SHA | |
env: | |
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | |
REPOSITORY: ${{ secrets.ARTIFACT_REPO }} | |
GITHUB_SHA: ${{ github.sha }} | |
- name: Set image tag to 'latest' | |
run: | | |
docker tag us-central1-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/ops_terra_utils_slim:$GITHUB_SHA us-central1-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/ops_terra_utils_slim:latest | |
docker push us-central1-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/ops_terra_utils_slim:latest | |
env: | |
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | |
REPOSITORY: ${{ secrets.ARTIFACT_REPO }} | |
GITHUB_SHA: ${{ github.sha }} |