Skip to content

Commit aadceb8

Browse files
committed
Add or update the Azure App Service build and deployment workflow config
1 parent 0a74ea9 commit aadceb8

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/main_pawadopt.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
2+
# More GitHub Actions for Azure: https://github.com/Azure/actions
3+
4+
name: Build and deploy Node.js app to Azure Web App - PAWAdopt
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Node.js version
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '20.x'
23+
24+
- name: npm install, build, and test
25+
run: |
26+
npm install
27+
npm run build --if-present
28+
npm run test --if-present
29+
30+
- name: Zip artifact for deployment
31+
run: zip release.zip ./* -r
32+
33+
- name: Upload artifact for deployment job
34+
uses: actions/upload-artifact@v3
35+
with:
36+
name: node-app
37+
path: release.zip
38+
39+
deploy:
40+
runs-on: ubuntu-latest
41+
needs: build
42+
environment:
43+
name: 'Production'
44+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
45+
permissions:
46+
id-token: write #This is required for requesting the JWT
47+
48+
steps:
49+
- name: Download artifact from build job
50+
uses: actions/download-artifact@v3
51+
with:
52+
name: node-app
53+
54+
- name: Unzip artifact for deployment
55+
run: unzip release.zip
56+
57+
- name: Login to Azure
58+
uses: azure/login@v1
59+
with:
60+
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_F760B1FC066E48C8BBBECCE6955DA09A }}
61+
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_6831CA11D1AC46D98CC34FC3B769CDF1 }}
62+
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_C24E75BE66DB4411A16C5DD984CB6AC8 }}
63+
64+
- name: 'Deploy to Azure Web App'
65+
id: deploy-to-webapp
66+
uses: azure/webapps-deploy@v2
67+
with:
68+
app-name: 'PAWAdopt'
69+
slot-name: 'Production'
70+
package: .
71+

0 commit comments

Comments
 (0)