From fd33469501865d19a3300a4f7c52c9f3a859ca8a Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Thu, 11 Jul 2024 18:25:38 +0200 Subject: [PATCH] Add GH action to deploy to Cloud run --- .github/workflows/ci.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4da2a04..f518e54 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -153,3 +153,34 @@ jobs: subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: true + + # deploy built server to Gcloud run action when pushing to main + deploy-server: + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + needs: + - build-and-push-image + permissions: + contents: read + packages: read + + steps: + - name: 📥 Checkout repository + uses: 'actions/checkout@v4' + + - name: 👮 Log in to Google Cloud + id: auth + uses: 'google-github-actions/auth@v2' + with: + credentials_json: '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}' + + - name: 🚀 Deploy to Cloud Run + id: 'deploy' + uses: 'google-github-actions/deploy-cloudrun@v2' + with: + service: 'leios-server' + image: 'us-east1-docker.pkg.dev/iog-hydra/leios-docker/${{ env.IMAGE_NAME}}:${{ github.sha }}' + region: 'us-east1' + + - name: 🔬 'Use output' + run: 'curl -v -L "${{ steps.deploy.outputs.url }}"'