-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (41 loc) · 1.11 KB
/
gpt-api.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
45
46
47
name: CI/CD for GPT-API
on:
push:
branches:
- gpt-api
pull_request:
branches:
- gpt-api
defaults:
run:
working-directory: ./gpt-api
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Install dependencies
run: go mod tidy
- name: Build for ARM64 on Amazon Linux 2023
env:
GOOS: linux
GOARCH: arm64
CGO_ENABLED: 0
run: go build -tags lambda.norpc -o bootstrap main.go
- name: Deploy to AWS Lambda
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
LAMBDA_FUNCTION_NAME: ${{ secrets.GPT_API_LAMBDA_FUNCTION_NAME }}
GPT_API_KEY: ${{ secrets.GPT_API_KEY }}
run: |
zip function.zip bootstrap
aws lambda update-function-code \
--function-name $LAMBDA_FUNCTION_NAME \
--zip-file fileb://function.zip