-
Notifications
You must be signed in to change notification settings - Fork 3
33 lines (31 loc) · 1.05 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
name: build
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: pip3 install -Ur requirements.txt
- name: Build docs
run: mkdocs -v build
- name: Deploy to GitHub Pages
if: "github.repository == 'ustclug/documentations' && github.ref == 'refs/heads/master'"
run: |
CINFO="$(git log -1 --pretty="[%h] %an: %s")"
cd site
git init --quiet
echo -n "docs.ustclug.org" > CNAME
: > .nojekyll
git remote add origin https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git
git fetch --depth=1 origin gh-pages
git reset --soft FETCH_HEAD
git add --all
git -c user.name=GitHub -c [email protected] commit \
-m "Auto deploy from GitHub Actions build ${GITHUB_RUN_NUMBER}" \
-m "$CINFO" \
--allow-empty
git push origin +HEAD:gh-pages