-
Notifications
You must be signed in to change notification settings - Fork 147
46 lines (44 loc) · 1.44 KB
/
build.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
name: build
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: "Linting: autocorrect"
run: |
curl -sSL https://raw.githubusercontent.com/huacnlee/autocorrect/main/install | sh
autocorrect --lint
- name: "Linting: markdownlint"
uses: DavidAnson/markdownlint-cli2-action@v15
with:
globs: docs/**/*.md
- name: Install dependencies
run: |
pip3 install -r requirements.txt
- name: Build documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TZ: Asia/Shanghai
run: make
- name: Deploy to GitHub Pages
if: github.event_name == 'push'
run: |
CINFO="$(git log -1 --pretty="%an: [%h] %B")"
git clone --depth=1 --branch=gh-pages --single-branch --no-checkout \
"https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" test
mv test/.git site/.git && rmdir test/
pushd site/ &>/dev/null
git add -A
git -c user.name=GitHub -c [email protected] commit \
-m "Auto deploy from GitHub Actions build ${GITHUB_RUN_NUMBER}" \
-m "$CINFO"
git push
popd &>/dev/null