fixed err #2
Workflow file for this run
This file contains 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 to Lambda" | |
on: | |
push: | |
branches: [deploy-api-to-lambda] | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./api | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup environment variables | |
run: | | |
cp environment-sample.json environment.json | |
echo "`jq '.mailer.host = \"${{ secrets.EMAIL_HOST }}\"' environment.json`" > environment.json | |
echo "`jq '.mailer.port = \"${{ secrets.EMAIL_PORT }}\"' environment.json`" > environment.json | |
echo "`jq '.mailer.username = \"${{ secrets.EMAIL_USERNAME }}\"' environment.json`" > environment.json | |
echo "`jq '.mailer.password = \"${{ secrets.EMAIL_PASSWORD }}\"' environment.json`" > environment.json | |
echo "`jq '.jwt.secret_key = \"${{ secrets.JWT_KEY }}\"' environment.json`" > environment.json | |
echo "`jq '.config.database_connection = \"${{ secrets.DATABASE_CONNECTION_STRING }}\"' environment.json`" > environment.json | |
echo "`jq '.config.port = \"${{ vars.PORT }}\"' environment.json`" > environment.json | |
- uses: actions/setup-go@v5 | |
- name: Build | |
run: | | |
GOOS=linux GOARCH=arm64 | |
go build -o api | |
- name: Configure AWS Credentials | |
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: ${{ vars.AWS_REGION }} | |
- name: Deploy to Lambda | |
run: | | |
zip -r api.zip api environment.json | |
aws lambda update-function-code \ | |
--function-name=${{ vars.LAMBDA_FUNCTION_NAME }} \ | |
--zip-file=fileb://api.zip | |
aws lambda update-function-configuration \ | |
--function-name=${{ vars.LAMBDA_FUNCTION_NAME }} \ | |
--handler="main" \ | |
--memory-size="256" |