|
19 | 19 |
|
20 | 20 |
|
21 | 21 |
|
22 | | -name: Build and Deploy Node.js App to Azure |
23 | | - |
24 | | -on: |
25 | 22 |
|
26 | 23 |
|
27 | 24 |
|
28 | 25 |
|
29 | 26 |
|
30 | 27 |
|
31 | | - # @@ -83,3 +62,4 @@ jobs: |
32 | | - |
| 28 | +name: Build and Deploy Node.js App to Azure |
| 29 | + |
| 30 | +on: |
33 | 31 | push: |
34 | 32 | branches: [ "master" ] |
35 | 33 | workflow_dispatch: |
| 34 | + |
36 | 35 | env: |
37 | 36 | AZURE_WEBAPP_NAME: recipe-for-success |
38 | 37 | AZURE_WEBAPP_PACKAGE_PATH: '.' |
39 | 38 | NODE_VERSION: '14.x' |
| 39 | + |
40 | 40 | permissions: |
41 | 41 | contents: read |
| 42 | + |
42 | 43 | jobs: |
43 | 44 | build: |
44 | 45 | runs-on: ubuntu-latest |
45 | 46 | steps: |
46 | | - - uses: actions/checkout@v4 |
47 | | - - name: Set up Node.js |
48 | | - uses: actions/setup-node@v3 |
49 | | - with: |
50 | | - node-version: ${{ env.NODE_VERSION }} |
51 | | - cache: 'npm' |
52 | | - - name: Install Dependencies |
53 | | - run: npm install |
54 | | - - name: Build Application |
55 | | - run: npm run build --if-present |
56 | | - - name: Test Application |
57 | | - run: npm run test --if-present |
58 | | - - name: Upload artifact for deployment job |
59 | | - uses: actions/upload-artifact@v3 |
60 | | - with: |
61 | | - name: node-app |
62 | | - path: . |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + - name: Set up Node.js |
| 49 | + uses: actions/setup-node@v3 |
| 50 | + with: |
| 51 | + node-version: ${{ env.NODE_VERSION }} |
| 52 | + cache: 'npm' |
| 53 | + - name: Install Dependencies |
| 54 | + run: npm install |
| 55 | + - name: Build Application |
| 56 | + run: npm run build --if-present |
| 57 | + - name: Test Application |
| 58 | + run: npm run test --if-present |
| 59 | + - name: Upload artifact for deployment job |
| 60 | + uses: actions/upload-artifact@v3 |
| 61 | + with: |
| 62 | + name: node-app |
| 63 | + path: . |
| 64 | + |
63 | 65 | deploy: |
64 | 66 | permissions: |
65 | 67 | contents: none |
66 | 68 | runs-on: ubuntu-latest |
67 | 69 | needs: build |
68 | 70 | steps: |
69 | | - - name: Download artifact from build job |
70 | | - uses: actions/download-artifact@v3 |
71 | | - with: |
72 | | - name: node-app |
73 | | - - name: 'Login via Azure CLI' |
74 | | - uses: azure/login@v1 |
75 | | - with: |
76 | | - creds: ${{ secrets.AZURE_CREDENTIALS }} |
77 | | - - name: 'Deploy to Azure WebApp' |
78 | | - uses: azure/webapps-deploy@v2 |
79 | | - with: |
80 | | - app-name: ${{ env.AZURE_WEBAPP_NAME }} |
81 | | - publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} |
82 | | - package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} |
| 71 | + - name: Download artifact from build job |
| 72 | + uses: actions/download-artifact@v3 |
| 73 | + with: |
| 74 | + name: node-app |
| 75 | + - name: 'Login via Azure CLI' |
| 76 | + uses: azure/login@v1 |
| 77 | + with: |
| 78 | + creds: ${{ secrets.AZURE_CREDENTIALS }} |
| 79 | + - name: 'Deploy to Azure WebApp' |
| 80 | + uses: azure/webapps-deploy@v2 |
| 81 | + with: |
| 82 | + app-name: ${{ env.AZURE_WEBAPP_NAME }} |
| 83 | + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} |
| 84 | + package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} |
0 commit comments