Search code examples
githubgithub-actionsgoogle-cloud-run

How to Deploy Cloud Run job By Github Action


I am trying to set up a GitHub action to automatically deploy whenever there's a commit into a Git repository. I followed a tutorial available at this URL. deploy-to-cloud-run

However, it is creating a Cloud Run service instead of a Cloud Run job. Can anyone help me with setting up GitHub action for a Cloud Run job?

I am trying to set up a GitHub action to automatically deploy whenever there's a commit into a Git repository.


Solution

  • Add this in your action pipeline:

    - name: Update Cloud Run Job
      run: |
        IMAGE_NAME=gcr.io/${{ secrets.GCP_PROJECT_ID }}/my-cloud-run-job
        gcloud run jobs update my-cloud-run-job \
          --image $IMAGE_NAME \
          --region ${{ secrets.GCP_REGION }} \
          --project ${{ secrets.GCP_PROJECT_ID }}