-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.75 KB
/
main-build.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
name: Build website and deploy to Github Pages
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
permissions:
contents: write
env:
APPLICATION_ID: ${{secrets.APPLICATION_ID}}
API_KEY: ${{secrets.API_KEY}}
INDEX_NAME: ${{secrets.INDEX_NAME}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: npm
- name: Install dependencies
run: npm install
- name: Create .env file
uses: ozaytsev86/create-env-file@v1
with:
ENV_APPLICATION_ID: ${{secrets.APPLICATION_ID}}
ENV_API_KEY: ${{secrets.API_KEY}}
ENV_INDEX_NAME: ${{secrets.INDEX_NAME}}
- name: Build website
run: npm run build
- name: Create .nojekyll file for GitHub Pages
run: |
mkdir -p build/test-site/ && touch -f build/test-site/.nojekyll
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{secrets.GITHUB_TOKEN}}
publish_dir: ./build
user_name: liuyuweitarek
user_email: [email protected]
- name: Get the content of algolia.json as config
id: algolia_config
run: echo "config=$(cat ./algolia/prod-algolia-config.json | jq -r tostring)" >> $GITHUB_OUTPUT
- name: Push indices to Algolia
uses: signcl/docsearch-scraper-action@master
with:
INDEX_NAME: ${{secrets.INDEX_NAME}}
APPLICATION_ID: ${{secrets.APPLICATION_ID}}
API_KEY: ${{secrets.API_KEY}}
CONFIG: ${{steps.algolia_config.outputs.config}}