Skip to content

trying env

trying env #7

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
cat environment.json
# - uses: actions/setup-go@v5
# - name: Build
# run: |
# GOOS=linux GOARCH=arm64
# go build -tags lambda.norpc -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 \
# --region=${{ vars.AWS_REGION }} \
# --publish
# aws lambda update-function-configuration \
# --function-name=${{ vars.LAMBDA_FUNCTION_NAME }} \
# --handler="api" \
# --memory-size="256"