This repository was archived by the owner on Sep 25, 2025. It is now read-only.
update #11
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 to AWS Lambda | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| name: Deploy Node.js Lambda (TypeScript) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: For Debug | |
| run: | | |
| echo "AWS_REGION=${{ secrets.AWS_REGION }}" | |
| echo "LAMBDA_FUNCTION_NAME=${{ secrets.LAMBDA_FUNCTION_NAME }}" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install all deps for build | |
| run: npm ci | |
| - name: Build TypeScript | |
| run: npm run build | |
| - name: Remove node_modules and reinstall prod-only deps | |
| run: | | |
| rm -rf node_modules | |
| npm ci --omit=dev | |
| - name: Zip Lambda function | |
| run: | | |
| zip -r function.zip dist/* node_modules/ | |
| - 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: ${{ secrets.AWS_REGION }} | |
| - name: Deploy to Lambda | |
| run: | | |
| aws lambda update-function-code \ | |
| --function-name ${{ secrets.LAMBDA_FUNCTION_NAME }} \ | |
| --zip-file fileb://function.zip |