2424 with :
2525 github-token : ${{ secrets.GITHUB_TOKEN }}
2626
27- validate-package-json :
28- needs : check-permission
29- runs-on : ubuntu-latest
30- steps :
31- - uses : actions/checkout@v2
32-
33- - name : Validate package.json
34- uses : zowe-actions/shared-actions/validate-package-json@main
35-
3627 build-test :
3728 runs-on : ubuntu-latest
38- needs : validate-package-json
3929 steps :
4030 - name : ' [Prep 1] Checkout'
4131 uses : actions/checkout@v2
@@ -52,40 +42,25 @@ jobs:
5242 restore-keys : |
5343 ${{ runner.os }}-build-cache-node-modules-
5444
55- - name : ' [Prep 4] Prepare workflow'
56- uses : zowe-actions/shared-actions/prepare-workflow@main
57-
58- - name : ' [Prep 5] Setup Node'
45+ - name : ' [Prep 3] Setup Node'
5946 uses : actions/setup-node@v2
6047 with :
6148 node-version : 8.11.4
6249
63- - name : ' [Setup] NodeJS project setup'
64- uses : zowe-actions/nodejs-actions/setup@main
65- with :
66- package-name : ' org.zowe.zebra'
67-
6850 - name : ' [Build] Nodejs project build'
69- run : npm run prod
51+ run : npm --prefix src run build
7052
7153 - name : ' [Test] Nodejs project unit test'
72- run : npm run test
73-
74- - name : ' [Scan 1] Fix code coverage paths'
75- working-directory : ./coverage
76- run : sed -i 's#'$GITHUB_WORKSPACE'#/github/workspace/#g' lcov.info
77-
78- - name : ' [Scan 2] SonarCloud Scan'
79- uses : sonarsource/sonarcloud-github-action@master
80- env :
81- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
82- SONAR_TOKEN : ${{ secrets.SONARCLOUD_TOKEN }}
83- sonar.projectVersion : ${{ env.P_VERSION }}
84- sonar.links.ci : ' https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
54+ run : npm --prefix src run test
8555
56+ deploy :
57+ runs-on : ubuntu-latest
58+ needs : [check-permission, build-test]
59+ if : ${{ success() && github.event_name == 'push' }}
60+ steps :
8661 - name : ' [Deploy] Deploy to demo server'
8762 uses : appleboy/ssh-action@master
88- if : success()
63+ if : ${{ success() && github.event_name == 'push' }}
8964 with :
9065 host : ${{ secrets.DEMO_SERVER_HOST }}
9166 username : ${{ secrets.DEMO_SERVER_USERNAME }}
0 commit comments