-
Notifications
You must be signed in to change notification settings - Fork 11
127 lines (107 loc) · 3.23 KB
/
ci.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: ci
on:
pull_request:
types: [opened, synchronize, reopened, closed]
branches: [main]
push:
branches: [main]
permissions:
contents: write
pages: write
pull-requests: write
id-token: write
jobs:
check_build_and_deploy_job:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
runs-on: ubuntu-latest
name: Build PR and Deploy 🚀
steps:
- name: Checkout repo 🛎️
uses: actions/checkout@v4
- name: Use Node 18.x 🔧
uses: actions/setup-node@v4
with:
node-version: "18.x"
cache: "yarn"
- name: Install Dependencies 📦
run: |
yarn install
- name: Build ⚙️
run: |
yarn build
- name: Deploy Staging Environment 🚀
uses: Azure/static-web-apps-deploy@latest
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "/build"
skip_app_build: true
skip_deploy_on_missing_secrets: true
- name: Run linters and formatter checks 💄
run: |
yarn typecheck
yarn lint:ci
yarn prettier:ci
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Cleanup Staging Environment 🧹
steps:
- name: Cleanup Staging Environment 🧹
uses: Azure/static-web-apps-deploy@latest
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: "close"
skip_deploy_on_missing_secrets: true
build_release_gh_pages:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
name: Build and Push GitHub Pages Site 🚀
concurrency:
group: build_release_gh_pages
cancel-in-progress: true
steps:
- name: Checkout repo 🛎️
uses: actions/checkout@v4
- name: Use Node 18.x 🔧
uses: actions/setup-node@v4
with:
node-version: "18.x"
cache: "yarn"
- name: Setup Pages 📃
id: pages
uses: actions/configure-pages@v5
- name: Install Dependencies 📦
run: |
yarn install
- name: Run linter and formatter checks 🚨
run: |
yarn typecheck
yarn lint:ci
yarn prettier:ci
- name: Build ⚙️
run: |
yarn build
- name: Upload artifact ⬆️
uses: actions/upload-pages-artifact@v3
with:
path: build/
- name: Deploy to GitHub Pages 🚀
id: deployment
uses: actions/deploy-pages@v4
update_search_db:
runs-on: ubuntu-latest
name: Update search DB 🔍
needs: build_release_gh_pages
steps:
- name: Checkout repo 🛎️
uses: actions/checkout@v4
- name: Run DocSearch Scraper 🔍
uses: celsiusnarhwal/typesense-scraper@v2
with:
api-key: ${{ secrets.TYPESENSE_API_KEY }}
host: typesense.acmuic.org
port: 443
protocol: https
config: docsearch.config.json