Skip to content

Commit b03dd14

Browse files
authored
Merge pull request #152 from sgollapudi77/patch-3
Update node.js-webapp-on-azure.yml
2 parents 2d29660 + 16bb412 commit b03dd14

File tree

1 file changed

+49
-23
lines changed

1 file changed

+49
-23
lines changed

AppService/node.js-webapp-on-azure.yml

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,56 @@ env:
1616
NODE_VERSION: '16.x' # set this to the node version to use
1717

1818
jobs:
19-
build-and-deploy:
20-
name: Build and Deploy
19+
build:
2120
runs-on: ubuntu-latest
22-
environment: dev
21+
2322
steps:
24-
- uses: actions/checkout@v3
25-
- name: Use Node.js ${{ env.NODE_VERSION }}
26-
uses: actions/setup-node@v3
27-
with:
28-
node-version: ${{ env.NODE_VERSION }}
29-
- name: npm install, build, and test
30-
run: |
31-
# Build and test the project, then
32-
# deploy to Azure Web App.
33-
npm prune --production
34-
npm install
35-
npm run build --if-present
36-
# npm run test --if-present
37-
- name: 'Deploy to Azure WebApp'
38-
uses: azure/webapps-deploy@v2
39-
with:
40-
app-name: ${{ env.AZURE_WEBAPP_NAME }}
41-
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
42-
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
43-
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Node.js version
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: ${{ env.NODE_VERSION }}
29+
30+
- name: npm install, build, and test
31+
run: |
32+
npm install
33+
npm run build --if-present
34+
# npm run test --if-present
35+
36+
- name: Zip artifact for deployment
37+
run: zip release.zip ./* -r
38+
39+
- name: Upload artifact for deployment job
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: node-app
43+
path: release.zip
44+
45+
deploy:
46+
runs-on: ubuntu-latest
47+
needs: build
48+
environment:
49+
name: 'production'
50+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
51+
52+
steps:
53+
- name: Download artifact from build job
54+
uses: actions/download-artifact@v3
55+
with:
56+
name: node-app
57+
58+
- name: Unzip artifact for deployment
59+
run: unzip release.zip
60+
61+
- name: 'Deploy to Azure Web App'
62+
id: deploy-to-webapp
63+
uses: azure/webapps-deploy@v2
64+
with:
65+
app-name: ${{ env.AZURE_WEBAPP_NAME }}
66+
slot-name: 'production'
67+
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
68+
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
69+
4470
# For more information on GitHub Actions for Azure, refer to https://github.com/Azure/Actions
4571
# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples

0 commit comments

Comments
 (0)