-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (55 loc) · 1.82 KB
/
main.yml
File metadata and controls
57 lines (55 loc) · 1.82 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
name: deploy to lambda
on:
push:
branches:
- master
jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 14.x ]
steps:
- uses: jungwinter/split@v1
id: splitrepo
with:
msg: ${{ github.repository }}
seperator: '/'
- uses: actions/github-script@v4
env:
SECRETS: ${{ toJson(secrets) }}
id: filterSecrets
with:
script: |
const secrets = JSON.parse(process.env.SECRETS);
const newSecrets = {};
Object.keys(secrets).forEach(key => {
if (key.indexOf('SECRET_') === 0) {
newSecrets[key.substring('SECRET_'.length)] = secrets[key];
}
});
return newSecrets;
result-encoding: json
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Redis Server in GitHub Actions
uses: supercharge/[email protected]
- run: npm ci
- run: npm run build --if-present
- run: npm run test --if-present
- name: serverless deploy
uses: serverless/github-action@master
with:
args: deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.SERVERLESS_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SERVERLESS_AWS_SECRET_ACCESS_KEY }}
AWS_STORAGE_ARN: ${{ secrets.SERVERLESS_AWS_STORAGE_ARN }}
AWS_STORAGE_SG: ${{ secrets.SERVERLESS_AWS_STORAGE_SG }}
AWS_STORAGE_SUBNET: ${{ secrets.SERVERLESS_AWS_STORAGE_SUBNET }}
REPO_SECRETS_JSON: ${{ steps.filterSecrets.outputs.result }}
GITHUB_REPO_NAME: ${{ steps.splitrepo.outputs._1 }}