-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.45 KB
/
deploy.yml
File metadata and controls
50 lines (42 loc) · 1.45 KB
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
name: Serverless Deployment
on:
push:
branches:
- main
- release
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Set up Node.js version 20.x for the whole job
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x # This sets Node.js version 20.x globally for the job
cache: npm # Cache npm dependencies to speed up subsequent runs
# Install dependencies using the specified Node.js version
- name: Install dependencies
run: npm install
# Configure AWS credentials
- 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: eu-central-1
# Determine the deployment stage based on the branch
- name: Set deployment stage
id: set-stage
run: |
if [ "${{ github.ref }}" == "refs/heads/release" ]; then
echo "stage=prod" >> $GITHUB_ENV
else
echo "stage=dev" >> $GITHUB_ENV
fi
# Deploy to Serverless using the specified stage
- name: Deploy to Serverless
env:
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }}
run: npx serverless deploy --stage ${{ env.stage }}