-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (74 loc) · 2.41 KB
/
static_webapp_pipeline.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Azure Static Web Apps CI/CD
run-name: "Azure Static Web Apps CI/CD for commit ${{ github.sha }}"
on:
push:
branches:
- main
paths:
- "webapp/**"
- "api/**"
- ".github/workflows/static_webapp_pipeline.yaml"
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
paths:
- "webapp/**"
- "api/**"
- ".github/workflows/static_webapp_pipeline.yaml"
env:
APP_LOCATION: "webapp"
API_LOCATION: "api"
OUTPUT_LOCATION: "dist/semantic-searcher"
permissions:
issues: write
contents: read
pull-requests: write
jobs:
webapp_ci:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
runs-on: ubuntu-latest
name: Test Webapp
defaults:
run:
working-directory: ${{ env.APP_LOCATION }}
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: "18"
- name: Test
run: npm install && npm test
api_ci:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
runs-on: ubuntu-latest
name: Test API
defaults:
run:
working-directory: ${{ env.API_LOCATION }}
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: "18"
- name: Test
run: npm install && npm test
build_and_deploy:
if: github.event_name == 'push'
runs-on: ubuntu-latest
name: Build and Deploy
steps:
- uses: actions/[email protected]
- name: Build And Deploy
uses: Azure/static-web-apps-deploy@v1
env:
NODE_VERSION: "18.14.0"
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: ${{ env.APP_LOCATION }}
api_location: ${{ env.API_LOCATION }}
app_build_command: "npm run build"
api_build_command: "npm run build"
output_location: ${{ env.OUTPUT_LOCATION }}