Skip to content

Commit 02b30e3

Browse files
committed
Use single workflow for deployment to both Azure and GitHub Pages
1 parent 03a0ea8 commit 02b30e3

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
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
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
name: Build Angular App
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: '22.x'
26+
27+
- name: Install dependencies and build
28+
run: |
29+
npm install
30+
npm run build:azure
31+
32+
- name: Upload artifact for test/deploy jobs
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: angular-app
36+
path: ./dist/browser # package all files in dist/browser and name the artifact "node-app"
37+
38+
test:
39+
name: Run Unit and E2E Tests
40+
runs-on: ubuntu-latest
41+
needs: build
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- name: Set up Node.js
46+
uses: actions/setup-node@v3
47+
with:
48+
node-version: '22.x'
49+
50+
- name: Install dependencies
51+
run: npm ci
52+
53+
- name: Run unit tests
54+
run: npm run test:headless
55+
56+
- name: Run e2e tests
57+
run: npm run e2e:headless
58+
59+
deploy-azure-text-compare:
60+
name: Deploy to Azure text-1
61+
runs-on: ubuntu-latest
62+
needs: test
63+
steps:
64+
- name: Download build artifact
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: angular-app # download the artifact and extract to the current working directory
68+
69+
- name: Deploy to Azure text-compare
70+
id: deploy-to-text1
71+
uses: azure/webapps-deploy@v3
72+
with:
73+
app-name: 'text-compare'
74+
slot-name: 'Production'
75+
package: . # deploy with all files in the current working directory
76+
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_4F4C478D91D44F8BBEF8951570103698 }}
77+
clean: true
78+
79+
deploy-azure-text-compare2:
80+
name: Deploy to Azure text-2
81+
runs-on: ubuntu-latest
82+
needs: test
83+
steps:
84+
- name: Download build artifact
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: angular-app # download the artifact and extract to the current working directory
88+
89+
- name: Deploy to Azure text-compare2
90+
id: deploy-to-text2
91+
uses: azure/webapps-deploy@v3
92+
with:
93+
app-name: 'text-compare2'
94+
slot-name: 'Production'
95+
package: . # deploy with all files in the current working directory
96+
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_23137CCA3349499E9B3DCC0705F4C348 }}
97+
clean: true
98+
99+
deploy-github-pages:
100+
name: Deploy to GitHub Pages
101+
runs-on: ubuntu-latest
102+
needs: test
103+
steps:
104+
- name: Checkout code
105+
uses: actions/checkout@v4
106+
107+
- name: Setup Node.js
108+
uses: actions/setup-node@v4
109+
with:
110+
node-version: '22.x'
111+
112+
- name: Install dependencies
113+
run: npm ci
114+
115+
- name: Build Angular app
116+
run: npm run build:pages2
117+
118+
- name: Deploy to GitHub Pages
119+
uses: JamesIves/github-pages-deploy-action@v4
120+
with:
121+
branch: gh-pages
122+
folder: dist/browser
123+
clean: true

0 commit comments

Comments
 (0)