This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
Merge pull request #240 from pangeo-forge/cisaacstern-patch-1 #43
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: Push Dataflow Container Image to GCR | |
on: | |
# push: | |
# branches: | |
# - main | |
# - prod | |
# paths: | |
# - 'dataflow-container-image.txt' | |
# pull_request: | |
# branches: | |
# - main | |
# - prod | |
# paths: | |
# - 'dataflow-container-image.txt' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
push-image: | |
runs-on: ubuntu-latest | |
env: | |
GCP_PROJECT: pangeo-forge-4967 | |
GCP_ACCOUNT: google-container-registry@pangeo-forge-4967.iam.gserviceaccount.com | |
steps: | |
- uses: actions/checkout@v3 | |
- id: 'auth' | |
name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ secrets.GOOGLE_CONTAINER_REGISTRY_CREDS }}' | |
- name: 'Setup gcloud' | |
uses: 'google-github-actions/setup-gcloud@v1' | |
- name: push image to gcr | |
run: > | |
gcloud auth activate-service-account ${{ env.GCP_ACCOUNT }} --key-file='${{ steps.auth.outputs.credentials_file_path }}' | |
&& gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin https://gcr.io | |
&& export IMAGE_SRC=$(cat dataflow-container-image.txt) | |
&& docker pull $IMAGE_SRC | |
&& export IMAGE_DST=gcr.io/${{ env.GCP_PROJECT }}/$IMAGE_SRC | |
&& docker tag $IMAGE_SRC $IMAGE_DST | |
&& docker push $IMAGE_DST |