Skip to content

Commit 7309688

Browse files
committed
Fix CI for PR and non-master branch pushes
1 parent edfc547 commit 7309688

File tree

2 files changed

+67
-4
lines changed

2 files changed

+67
-4
lines changed

.github/workflows/build.yaml renamed to .github/workflows/deploy.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ name: build
33
on:
44
push:
55
branches:
6-
- "*"
7-
pull_request:
8-
branches:
9-
- "*"
6+
- "master"
107

118
permissions:
129
contents: write
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: build
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches-ignore:
7+
- "master"
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
20+
- name: Install dependencies
21+
run: |
22+
pip3 install \
23+
-r requirements.txt \
24+
-r requirements-ci.txt
25+
26+
- name: "Linting: autocorrect"
27+
continue-on-error: true
28+
run: |
29+
curl -fsSL https://raw.githubusercontent.com/huacnlee/autocorrect/main/install | sh
30+
autocorrect --fix
31+
32+
- name: "Linting: markdownlint-cli2 Part 1"
33+
uses: DavidAnson/markdownlint-cli2-action@v15
34+
continue-on-error: true
35+
with:
36+
fix: true
37+
globs: |
38+
docs/**/*.md
39+
README.md
40+
41+
- name: "Linting: markdownlint-cli2 Part 2"
42+
uses: DavidAnson/markdownlint-cli2-action@v15
43+
continue-on-error: true
44+
with:
45+
fix: true
46+
globs: |
47+
docs/**/*.md
48+
README.md
49+
- name: Stop and report errors
50+
run: |
51+
git add -A
52+
if ! git diff-index --quiet --cached HEAD --; then
53+
echo "Stop."
54+
exit 1
55+
fi
56+
57+
- name: Build docs
58+
run: |
59+
mkdocs -v build
60+
: > site/.nojekyll
61+
echo -n '201.ustclug.org' > site/CNAME
62+
- name: Upload artifact
63+
if: github.ref == 'refs/heads/master'
64+
uses: actions/upload-pages-artifact@v3
65+
with:
66+
path: site

0 commit comments

Comments
 (0)