-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (76 loc) · 2.59 KB
/
nodejs.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Dialogflow CI
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup NodeJs 8
uses: actions/setup-node@v1
with:
node-version: 8.x
- name: Install dialogflow-cli
run: npm install dialogflow-cli -g
- run: echo $credentials_json > ./credentials.json
env:
credentials_json: ${{ secrets.CREDENTIALS_JSON }}
- run: dialogflow-cli import --credentials ./credentials.json .
env:
CI: true
- name: Setup NodeJs 13
uses: actions/setup-node@v1
with:
node-version: 13.x
registry-url: 'https://npm.pkg.github.com'
scope: '@grouch-trash-service'
- name: Install firebase-tools
run: npm install firebase-tools -g
- name: Install
run: npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: npm test
- name: Run local cucumber tests
run: |
echo $runtime_config > .runtimeconfig.json
firebase emulators:exec "npm run cucumber"
env:
runtime_config: ${{ secrets.RUNTIME_CONFIG }}
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Check Sonar Status
run: |
status=$(curl https://sonarcloud.io/api/qualitygates/project_status?projectKey=matthew-js-porter_oscar-google-action)
echo $status | jq '.'
status=$(echo $status | jq '.projectStatus.status')
test '"OK"' = $status
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --file=functions/package-lock.json --severity-threshold=high --policy-path=.snyk
- name: Replace .npmrc with token
run: sed -i.bak "s/\${NODE_AUTH_TOKEN}/${NODE_AUTH_TOKEN}/g" functions/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: update Firebase env
run: firebase functions:config:set api.url="https://d9lz2a1tq2.execute-api.us-east-1.amazonaws.com/Prod" api.key="$api_key" --token "$firebase_token"
env:
api_key: ${{ secrets.AWS_API_KEY }}
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
- name: Deploy Firebase
run: firebase deploy --token "$firebase_token"
env:
firebase_token: ${{ secrets.FIREBASE_TOKEN }}
CI: true
- name: Run Cucumber Tests
run: npm run cucumber
env:
NODE_ENV: production