Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Change GHA deployment

Tomas Valenta7ef788b280df
diff --git a/.github/workflows/api-service.yml b/.github/workflows/api-service.yml
deleted file mode 100644
index 54a50c5ee..000000000
--- a/.github/workflows/api-service.yml
+++ /dev/null
@@ -1,54 +0,0 @@
-name: API service
-
-on:
- push:
- paths:
- - 'api-service/**'
- branches:
- - preview
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
-
-permissions:
- id-token: write
- contents: read
-
-env:
- IMAGE_TAG: us-central1-docker.pkg.dev/${{ secrets.GCE_PROJECT }}/services/ai-api-service:latest
-
-jobs:
- release:
- name: Build and release
- runs-on: ubuntu-20.04
- steps:
- - name: Checkout repository
- uses: actions/checkout@v3
-
- - name: Setup Service Account
- uses: google-github-actions/auth@v1
- with:
- workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
- service_account: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
-
- - name: Configure Docker
- run: gcloud --quiet auth configure-docker us-central1-docker.pkg.dev
-
- - name: Set up Docker Buildx
- uses: docker/setup-buildx-action@v2
-
- - name: Build and Push
- uses: docker/build-push-action@v3
- with:
- context: ./api-service
- push: true
- tags: ${{ env.IMAGE_TAG }}
- cache-from: type=gha,scope=ai-api-service
- cache-to: type=gha,scope=ai-api-service
-
- - name: Deploy
- uses: google-github-actions/deploy-cloudrun@v1
- with:
- service: ai-api-service
- image: ${{ env.IMAGE_TAG }}
diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml
index 69625f9f8..111907195 100644
--- a/.github/workflows/api.yml
+++ b/.github/workflows/api.yml
@@ -1,11 +1,11 @@
-name: Build and Deploy API to Google Compute Engine
+name: Build and deploy API
on:
push:
paths:
- 'api-service/**'
branches:
- - agent
+ - production
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -17,12 +17,9 @@ permissions:
env:
IMAGE_TAG: us-central1-docker.pkg.dev/${{ secrets.GCE_PROJECT }}/services/e2b-api:latest
- GCE_INSTANCE: e2b-api-instance-1
- GCE_INSTANCE_ZONE: us-central1-a
-# TODO: Update - https://stackoverflow.com/questions/68244641/how-to-circumvent-compute-engines-downtime-during-container-deployments
jobs:
- deploy:
+ release:
name: Build and release
runs-on: ubuntu-20.04
steps:
@@ -50,15 +47,8 @@ jobs:
cache-from: type=gha,scope=e2b-api
cache-to: type=gha,scope=e2b-api
- - name: Delete old docker images from the instance
- run: |-
- gcloud compute instances add-metadata "$GCE_INSTANCE" \
- --zone "$GCE_INSTANCE_ZONE" \
- --metadata startup-script="#! /bin/bash
- docker image prune -af"
-
- - name: Update the server container
- run: |-
- gcloud compute instances update-container "$GCE_INSTANCE" \
- --zone "$GCE_INSTANCE_ZONE" \
- --container-image "$IMAGE_TAG"
+ - name: Deploy
+ uses: google-github-actions/deploy-cloudrun@v1
+ with:
+ service: e2b-api
+ image: ${{ env.IMAGE_TAG }}