From 38ffd88f62b72311b4636b56c830880903e4850b Mon Sep 17 00:00:00 2001 From: Wilfredo Aaron Sosa Ramos <113047749+AaronSosaRamos@users.noreply.github.com> Date: Thu, 5 Dec 2024 16:06:25 -0500 Subject: [PATCH 1/2] Create ci-cd-sandbox.yml --- .github/workflows/ci-cd-sandbox.yml | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/ci-cd-sandbox.yml diff --git a/.github/workflows/ci-cd-sandbox.yml b/.github/workflows/ci-cd-sandbox.yml new file mode 100644 index 00000000..03c2d154 --- /dev/null +++ b/.github/workflows/ci-cd-sandbox.yml @@ -0,0 +1,49 @@ +name: Deploy to Cloud Run + +env: + SERVICE_NAME: marvel-ai-backend-sandbox + PROJECT_ID: kai-platform-sandbox + DOCKER_IMAGE_URL: us-central1-docker.pkg.dev/kai-platform-sandbox/marvel-ai-backend-sandbox/marvel-ai-backend-sandbox + +on: + push: + branches: + - STAGING + pull_request: + branches: + - STAGING + +jobs: + dockerize-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Google Cloud Auth + uses: 'google-github-actions/auth@v2' + with: + credentials_json: '${{ secrets.SANDBOX_CREDENTIALS }}' + project_id: ${{ env.PROJECT_ID }} + + - name: Set up Cloud SDK + uses: 'google-github-actions/setup-gcloud@v2' + + - name: Configure Docker + run: | + gcloud auth configure-docker us-central1-docker.pkg.dev + + - name: Build and Push Docker Image + run: | + docker build -t ${{ env.DOCKER_IMAGE_URL }}:latest -f Dockerfile . + docker push ${{ env.DOCKER_IMAGE_URL }}:latest + + - name: Deploy to Cloud Run + run: | + echo SERVICE_NAME $SERVICE_NAME + gcloud run deploy $SERVICE_NAME \ + --image ${{ env.DOCKER_IMAGE_URL }}:latest \ + --platform managed \ + --region us-east1 \ + --allow-unauthenticated From 3296df646701e9d7bcda6bf5f5ec69f80672a5e7 Mon Sep 17 00:00:00 2001 From: Wilfredo Aaron Sosa Ramos <113047749+AaronSosaRamos@users.noreply.github.com> Date: Fri, 6 Dec 2024 08:47:59 -0500 Subject: [PATCH 2/2] Update ci-cd-sandbox.yml --- .github/workflows/ci-cd-sandbox.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci-cd-sandbox.yml b/.github/workflows/ci-cd-sandbox.yml index 03c2d154..c57491d4 100644 --- a/.github/workflows/ci-cd-sandbox.yml +++ b/.github/workflows/ci-cd-sandbox.yml @@ -8,10 +8,7 @@ env: on: push: branches: - - STAGING - pull_request: - branches: - - STAGING + - Develop jobs: dockerize-and-deploy: