feat: optimizes lambda #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Lambda Functions | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| - name: Set up Go | |
| uses: actions/setup-go@v2 | |
| with: | |
| go-version: 1.24.3 | |
| - name: AWS Credentials Configuration | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Install dependencies | |
| run: go mod download | |
| - name: Build and package lambda | |
| run: | | |
| mkdir -p bin | |
| mkdir -p bootstrap | |
| GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -tags lambda.norpc -o bin/bootstrap ./cmd/lambda/main.go | |
| zip -j bootstrap/${{ secrets.LAMBDA_NAME }}.zip bin/bootstrap | |
| - name: Upload to S3 | |
| run: | | |
| aws s3 cp bootstrap/${{ secrets.LAMBDA_NAME }}.zip s3://${{ secrets.LAMBDA_BUCKET }}/${{ secrets.LAMBDA_NAME }}.zip | |
| - name: Update Lambda function | |
| run: | | |
| aws lambda update-function-code \ | |
| --function-name ${{ secrets.LAMBDA_NAME }} \ | |
| --s3-bucket ${{ secrets.LAMBDA_BUCKET }} \ | |
| --s3-key ${{ secrets.LAMBDA_NAME }}.zip |