|
1 | 1 | name: CustomerWebpage-Deploy-WF |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
7 | | - - customer-map |
8 | | - paths: |
9 | | - - "frontend/customer-webapp/**" |
10 | | - - ".github/workflows/CustomerWebpage-Deploy-WF.yml" |
11 | | - workflow_dispatch: |
| 4 | +push: |
| 5 | +branches: |
| 6 | +- main |
| 7 | +- customer-map |
| 8 | +paths: |
| 9 | +- "frontend/customer-webapp/**" |
| 10 | +- ".github/workflows/CustomerWebpage-Deploy-WF.yml" |
12 | 11 |
|
13 | | -permissions: |
14 | | - contents: read |
| 12 | +workflow_dispatch: |
15 | 13 |
|
16 | 14 | jobs: |
17 | | - build-and-deploy: |
18 | | - name: Build and deploy customer web app |
19 | | - runs-on: ubuntu-latest |
20 | | - env: |
21 | | - AZURE_WEBAPP_NAME: WA-DeliveryBot-dev |
22 | | - AZURE_WEBAPP_PACKAGE_PATH: frontend/customer-webapp/dist |
23 | | - AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_1BA6A9C76C684517B5106BD8ACF4CE5B || secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} |
24 | | - |
25 | | - defaults: |
26 | | - run: |
27 | | - working-directory: frontend/customer-webapp |
| 15 | +build-and-deploy: |
| 16 | +runs-on: ubuntu-latest |
28 | 17 |
|
29 | | - steps: |
30 | | - - name: Checkout repository |
31 | | - uses: actions/checkout@v4 |
| 18 | +``` |
| 19 | +defaults: |
| 20 | + run: |
| 21 | + working-directory: frontend/customer-webapp |
32 | 22 |
|
33 | | - - name: Setup Node.js |
34 | | - uses: actions/setup-node@v4 |
35 | | - with: |
36 | | - node-version: '22.x' |
37 | | - cache: npm |
38 | | - cache-dependency-path: frontend/customer-webapp/package-lock.json |
| 23 | +steps: |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v4 |
39 | 26 |
|
40 | | - - name: Install dependencies |
41 | | - run: npm ci |
| 27 | + - name: Setup Node.js |
| 28 | + uses: actions/setup-node@v4 |
| 29 | + with: |
| 30 | + node-version: '22.x' |
42 | 31 |
|
43 | | - - name: Lint React app |
44 | | - run: npm run lint |
| 32 | + - name: Install dependencies |
| 33 | + run: npm ci |
45 | 34 |
|
46 | | - - name: Build React app |
47 | | - run: npm run build |
48 | | - env: |
49 | | - VITE_MAP_TILE_URL: ${{ vars.VITE_MAP_TILE_URL }} |
50 | | - VITE_SIMULATOR_API_BASE: ${{ vars.VITE_SIMULATOR_API_BASE }} |
| 35 | + - name: Lint application |
| 36 | + run: npm run lint |
51 | 37 |
|
52 | | - - name: Validate Azure publish profile |
53 | | - working-directory: . |
54 | | - run: | |
55 | | - if [ -z "$AZURE_WEBAPP_PUBLISH_PROFILE" ]; then |
56 | | - echo "Azure App Service publish profile secret is missing." |
57 | | - echo "Add either AZUREAPPSERVICE_PUBLISHPROFILE_1BA6A9C76C684517B5106BD8ACF4CE5B or AZURE_WEBAPP_PUBLISH_PROFILE as a GitHub Actions repository secret." |
58 | | - exit 1 |
59 | | - fi |
60 | | -
|
61 | | - - name: Deploy to Azure Web App |
62 | | - uses: azure/webapps-deploy@v3 |
63 | | - with: |
64 | | - app-name: ${{ env.AZURE_WEBAPP_NAME }} |
65 | | - publish-profile: ${{ env.AZURE_WEBAPP_PUBLISH_PROFILE }} |
66 | | - package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} |
| 38 | + - name: Build application |
| 39 | + run: npm run build |
| 40 | + env: |
| 41 | + VITE_MAP_TILE_URL: ${{ vars.VITE_MAP_TILE_URL }} |
| 42 | + VITE_SIMULATOR_API_BASE: ${{ vars.VITE_SIMULATOR_API_BASE }} |
| 43 | +
|
| 44 | + - name: Deploy to Azure Web App |
| 45 | + uses: azure/webapps-deploy@v3 |
| 46 | + with: |
| 47 | + app-name: WA-DeliveryBot-dev |
| 48 | + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_1BA6A9C76C684517B5106BD8ACF4CE5B }} |
| 49 | + package: frontend/customer-webapp/dist |
| 50 | +``` |
0 commit comments