-
Notifications
You must be signed in to change notification settings - Fork 423
70 lines (65 loc) · 1.91 KB
/
docs.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
name: Documentation
on:
push:
branches:
- main
paths:
- "docs/**"
- ".github/workflows/docs.yaml"
pull_request:
branches:
- main
paths:
- "docs/**"
- ".github/workflows/docs.yaml"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_ACCESS_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN }}
OUT_DIR: build/
TARGET_OUT_DIR: build/docs
jobs:
run:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "16"
- name: Build Docs
run: |
yarn
node ./node_modules/mdx-link-checker/index.js pages
yarn build
working-directory: ./docs
- name: Prepare Deployment
run: |
if [ ! -z "$NETLIFY_ACCESS_TOKEN" ]
then
rm -rf $OUT_DIR/docs/fragments $OUT_DIR/docs/**/fragments
mkdir -p tmp-$TARGET_OUT_DIR
mv $OUT_DIR/* tmp-$TARGET_OUT_DIR
mkdir -p $TARGET_OUT_DIR
mv tmp-$TARGET_OUT_DIR/* $TARGET_OUT_DIR
npm install -g netlify-cli@3.20.1
fi
working-directory: ./docs
- name: Deploy Preview Site
if: github.ref != 'refs/heads/main'
run: |
if [ ! -z "$NETLIFY_ACCESS_TOKEN" ]
then
netlify deploy --auth=$NETLIFY_ACCESS_TOKEN --site=$NETLIFY_SITE_ID --dir=$OUT_DIR
fi
working-directory: ./docs
- name: Deploy Production Site
if: github.ref == 'refs/heads/main'
run: |
if [ ! -z "$NETLIFY_ACCESS_TOKEN" ]
then
netlify deploy --auth=$NETLIFY_ACCESS_TOKEN --site=$NETLIFY_SITE_ID --dir=$OUT_DIR --prod
fi
working-directory: ./docs