File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ on: [push, pull_request]
44jobs :
55 build-test-and-release :
66 runs-on : ubuntu-latest
7-
87 steps :
98 - name : Checkout
109 uses : actions/checkout@v2
@@ -33,10 +32,35 @@ jobs:
3332 - name : Test
3433 run : npm run test
3534 - name : SonarCloud Scan
35+ if : ${{ github.event_name == 'push' }}
3636 uses : sonarsource/sonarcloud-github-action@master
3737 env :
3838 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3939 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
40+ release :
41+ needs : build-and-test
42+ runs-on : ubuntu-latest
43+ environment : production
44+ if : github.ref == 'refs/heads/main'
45+ steps :
46+ - name : Checkout
47+ uses : actions/checkout@v2
48+ - name : Setup Node.js
49+ uses : actions/setup-node@v1
50+ with :
51+ node-version : 12.x
52+ - name : Setup npm cache
53+ id : npm-cache
54+ run : |
55+ echo "::set-output name=dir::$(npm config get cache)"
56+ - uses : actions/cache@v2
57+ with :
58+ path : ${{ steps.npm-cache.outputs.dir }}
59+ key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
60+ restore-keys : |
61+ ${{ runner.os }}-node-
62+ - name : Install dependencies
63+ run : npm ci
4064 - name : Release
4165 env :
4266 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments