-
-
Notifications
You must be signed in to change notification settings - Fork 174
108 lines (90 loc) · 2.76 KB
/
Copy pathalgolia.yaml
File metadata and controls
108 lines (90 loc) · 2.76 KB
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
name: "Algolia"
on:
pull_request:
types:
- opened
- synchronize
- reopened
paths:
- "website/algolia/**"
- "website/docusaurus.config.js"
- "website/package.json"
- "website/pnpm-lock.yaml"
- ".github/workflows/algolia.yaml"
workflow_run:
workflows: ["Website Deploy Prod"]
types:
- completed
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: "website/.nvmrc"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Dependencies
run: |
cd website
pnpm install --frozen-lockfile
- name: Test Algolia crawler config
run: |
cd website
pnpm run test:algolia
- name: Validate deploy payload without upload
run: |
cd website
pnpm run algolia:deploy:dry-run
deploy:
if: |
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
needs:
- validate
runs-on: ubuntu-latest
environment:
name: algolia
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: "website/.nvmrc"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Dependencies
run: |
cd website
pnpm install --frozen-lockfile
- name: Deploy crawler config
run: |
cd website
pnpm run algolia:deploy
env:
ALGOLIA_CRAWLER_ID: ${{ secrets.ALGOLIA_CRAWLER_ID }}
ALGOLIA_CRAWLER_USER_ID: ${{ secrets.ALGOLIA_CRAWLER_USER_ID }}
ALGOLIA_CRAWLER_API_KEY: ${{ secrets.ALGOLIA_CRAWLER_API_KEY }}
ALGOLIA_CRAWLER_INDEXING_API_KEY: ${{ secrets.ALGOLIA_CRAWLER_INDEXING_API_KEY }}
# Deploy script PATCHes the crawler config and PUTs index settings, then
# POSTs /reindex. Order is critical: reindex must use the just-deployed
# config, and the site must already be live on S3 (guaranteed by the
# workflow_run trigger on Website Deploy Prod success).
ALGOLIA_CRAWLER_REINDEX: "true"