diff --git a/.github/workflows/google-cloudrun-docker.yml b/.github/workflows/google-cloudrun-docker.yml index 59d2a66..459f502 100644 --- a/.github/workflows/google-cloudrun-docker.yml +++ b/.github/workflows/google-cloudrun-docker.yml @@ -53,17 +53,17 @@ on: branches: - master -env: - PROJECT_ID: ${{ secrets.PROJECT_ID }} - GAR_LOCATION: ${{ secrets.GAR_LOCATION }} - SERVICE: ${{ secrets.SERVICE }} - REGION: ${{ secrets.REGION }} - jobs: deploy: environment: name: ${{ github.ref == 'refs/heads/master' && 'production' || 'debug' }} - + + env: + PROJECT_ID: ${{ secrets.PROJECT_ID }} + GAR_LOCATION: ${{ secrets.GAR_LOCATION }} + SERVICE: ${{ secrets.SERVICE }} + REGION: ${{ secrets.REGION }} + permissions: contents: 'read' id-token: 'write' @@ -87,7 +87,6 @@ jobs: registry: ${{ env.GAR_LOCATION }}-docker.pkg.dev username: _json_key password: ${{ secrets.GCR_SERVICE_ACCOUNT_JSON }} - # Build and push the Docker image, passing the .env_file - name: Build and Push Container @@ -107,10 +106,14 @@ jobs: env_vars=$(jq -r 'to_entries | map("\(.key)=\(.value)") | join(",")' env_vars.json) + # Set the output variable for the step echo "::set-output name=env_vars::$env_vars" #remove no longer needed env_vars.json file - rm -f env_vars.json + #rm -f env_vars.json + + - name: print out env + run: echo ${{ steps.json.outputs.env_vars }} - name: Deploy to Cloud Run id: deploy @@ -119,6 +122,7 @@ jobs: env_vars: ${{ steps.prepare-env.outputs.env_vars }} service: ${{ env.SERVICE }} region: ${{ env.REGION }} + project_id: ${{ env.PROJECT_ID }} image: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}/${{ env.SERVICE }}:${{ github.sha }} # If required, use the Cloud Run url output in later steps