-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (50 loc) · 1.86 KB
/
deploy.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Deploy AWS Lambda with Serverless
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install all dependencies
run: npm install
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
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: Compile TypeScript
run: npm run build
- name: Run ESLint to check code quality
run: npm run lint
- name: Run Jest tests
run: npm test
- name: Clear Up Testing Dependencies
run: npm run clear-testing-dependencies
- name: Install only Production Dependencies
run: npm run add-prod-dependencies
- name: Create .env file
run: |
echo "MONGO_URI=${{ secrets.MONGO_URI }}" >> .env
echo "SERVERLESS_ACCESS_KEY=${{ secrets.SERVERLESS_ACCESS_KEY }}" >> .env
echo "MONGO_URI is set to $MONGO_URI" # Debugging: Print the MONGO_URI value
cat .env # Show file contents
- name: Install Serverless,Dotenv,Prune
run: |
npm install -g serverless@3.40.0 serverless-prune-plugin serverless-dotenv-plugin
serverless --version # Debugging: Check installed version
- name: Prune the older versions
run: serverless prune -n 1
- name: Deploy with Serverless
env:
MONGO_URI: ${{ secrets.MONGO_URI }}
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
run: serverless deploy --verbose