Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Add new deploy action
Tomas Valentac4e4cb3e5a8e
diff --git a/.github/workflows/api.yml b/.github/workflows/api.ymlnew file mode 100644index 000000000..7cd80dc66--- /dev/null+++ b/.github/workflows/api.yml@@ -0,0 +1,63 @@+name: Build and Deploy to Google Compute Engine++# on:+# push:+# paths:+# - 'api/**'+# branches:+# - main++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/e2b-api:latest+ GCE_INSTANCE: e2b-api-instance-1+ GCE_INSTANCE_ZONE: us-central1-a++jobs:+ deploy:+ 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: 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"