-
Notifications
You must be signed in to change notification settings - Fork 1
44 lines (37 loc) · 1.93 KB
/
gcp-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: GCP Deployment
on:
push:
branches:
- master
paths:
- '**.py'
- 'requirements.txt'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Setup Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
# Check if the bucket exists and delete it
- name: Delete Existing Bucket
run: |
if gsutil ls "gs://$GCS_BUCKET_NAME"; then
gsutil -m rm -r "gs://$GCS_BUCKET_NAME"
fi
env:
GCS_BUCKET_NAME: ${{ secrets.GCS_BUCKET_NAME }}
# Create a new bucket
- name: Create New GCS Bucket
run: gsutil mb "gs://$GCS_BUCKET_NAME"
env:
GCS_BUCKET_NAME: ${{ secrets.GCS_BUCKET_NAME }}
- run: gcloud functions deploy ${{ secrets.GCP_FUNCTION }} --runtime python311 --memory 512MB --timeout 120s --trigger-http --allow-unauthenticated --entry-point process_event --region ${{ secrets.GCP_REGION }} --set-env-vars GCP_SA_KEY=${{ secrets.GCP_SA_KEY }},GCS_BUCKET_NAME=${{ secrets.GCS_BUCKET_NAME }},OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }},MODEL_NAME=${{ secrets.MODEL_NAME }},SYSTEM_PROMPT="${{ secrets.SYSTEM_PROMPT }}",MAX_TURNS="${{ secrets.MAX_TURNS }}",TTL="${{ secrets.TTL }}",MAX_TOKENS_INPUT="${{ secrets.MAX_TOKENS_INPUT }}",MAX_TOKENS_OUTPUT="${{ secrets.MAX_TOKENS_OUTPUT }}",TEMPERATURE="${{ secrets.TEMPERATURE }}",IMAGE_SIZE="${{ secrets.IMAGE_SIZE }}",IMAGE_STYLE="${{ secrets.IMAGE_STYLE}}",IMAGE_QUALITY="${{ secrets.IMAGE_QUALITY }}",DALLE_MODEL="${{ secrets.DALLE_MODEL }}",ELEVENLABS_API_KEY="${{ secrets.ELEVENLABS_API_KEY }}",ELEVENLABS_MODEL_NAME="${{ secrets.ELEVENLABS_MODEL_NAME }}"