-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (66 loc) · 1.86 KB
/
workflow.yml
File metadata and controls
81 lines (66 loc) · 1.86 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Deploy DEV
on:
pull_request:
branches: [ main ]
jobs:
testing-changes:
runs-on: ubuntu-latest
name: Build/Test
steps:
- uses: actions/checkout@v2
- name: NPM - Install dependencies
if: steps.cached-npm-dependencies.outputs.cache-hit != 'true'
run: 'npm install'
- name: Run Tests
run: |
npm run test
# layer build
buid-js-layer-deps:
timeout-minutes: 15
runs-on: ubuntu-latest
name: Build SLS Layer - Prod
container:
image: "node:14-buster"
steps:
- uses: actions/checkout@v2
- run: |
npm install --production
mkdir nodejs
mv node_modules nodejs
apt update -y && apt install zip -y
zip -r nodejs.zip nodejs/
- uses: actions/upload-artifact@v2
with:
name: nodejsdeps
path: nodejs.zip
deploy-env:
name: Deploy Lambda
runs-on: ubuntu-latest
needs: [testing-changes, buid-js-layer-deps]
steps:
- uses: actions/checkout@v2.0.0
- name: NPM - Load cached venv
id: cached-npm-dependencies
uses: actions/cache@v2
with:
path: node_modules
key: npm-${{ runner.os }}-${{ hashFiles('**/package.json') }}
- name: NPM - Install dependencies
if: steps.cached-npm-dependencies.outputs.cache-hit != 'true'
run: 'npm install'
- uses: actions/download-artifact@v2
with:
name: nodejsdeps
path: app/
- name: Deploy using sls
run: 'npx sls deploy'
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
with:
message: |
Your SLS App was deployed!
Awesome :D
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}