-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (66 loc) · 2.07 KB
/
main.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
name: Main CI Workflow
on: push
env:
DOCS_REPO_PATH: docs-repo
DOCS_BRANCH_NAME: gh-pages
DOCS_LOCAL_PATH: docs
jobs:
build-test-eslint-node-18:
name: Build, Test & Eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn install
- run: yarn build
- run: yarn test
- run: yarn eslint
- name: checkout docs branch
uses: actions/checkout@v3
with:
repository: ${{ env.GITHUB_REPOSITORY }}
token: ${{ secrets.GITHUB_TOKEN }}
path: ${{ env.DOCS_REPO_PATH }}
ref: ${{ env.DOCS_BRANCH_NAME }}
- name: Update Docs
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
# Get repo info from env
owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY")
repo=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY")
# build docs
yarn build-docs
# push to github page branch
cp --force -u -r ${DOCS_LOCAL_PATH}/* ${DOCS_REPO_PATH}/
rm -Rf ${DOCS_LOCAL_PATH}
pushd "${DOCS_REPO_PATH}" > /dev/null
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git add --all
git diff --cached --exit-code
retVal=$?
if [ $retVal -eq 0 ]; then
echo "No changes required to commit to the docs..."
exit 0
else
git commit --message="auto update docs" --signoff
git push "https://x-access-token:[email protected]/${GITHUB_REPOSITORY}" ${DOCS_BRANCH_NAME}
popd > /dev/null
fi
build-test-eslint-node-20:
name: Build, Test & Eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- run: yarn install
- run: yarn build
- run: yarn test
- run: yarn eslint