-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (63 loc) · 1.83 KB
/
ci-cd.yml
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
name: CI/CD
on:
push:
branches:
- main
- '!post/**'
paths-ignore:
- 'docs/**/*'
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
- '!post/**'
paths-ignore:
- 'docs/**/*.*'
jobs:
build_and_deploy:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy
steps:
- name: Checkout
uses: actions/checkout@v2
with:
lfs: true
submodules: true
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Generate DotEnv File
uses: iamsauravsharma/create-dotenv@v1.2.1
with:
env-prefix: "DOTENV_"
env:
DOTENV_AI_CONNECTION_STRING: ${{ secrets.AI_CONNECTION_STRING }}
- name: Build
id: build
run: |
npm install
npm run build
- name: Deploy
id: deploy
uses: Azure/static-web-apps-deploy@v1
with:
production_branch: "main"
azure_static_web_apps_api_token: ${{ secrets.SWA_DEPLOY_TOKEN }}
repo_token: ${{ secrets.GH_WORKFLOW_TOKEN }}
action: "upload"
app_location: "dist"
skip_app_build: true
close_pull_request:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close PR
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.SWA_DEPLOY_TOKEN }}
repo_token: ${{ secrets.GH_WORKFLOW_TOKEN }}
action: "close"