-
Notifications
You must be signed in to change notification settings - Fork 5
84 lines (75 loc) · 2.7 KB
/
build.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: build
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
pip3 install -r requirements.txt
- uses: DavidAnson/markdownlint-cli2-action@v15
continue-on-error: true
with:
fix: true
globs: |
docs/**/*.md
README.md
- uses: DavidAnson/markdownlint-cli2-action@v15
continue-on-error: true
with:
fix: true
globs: |
docs/**/*.md
README.md
- name: Determine if a PR should be submitted
if: github.ref == 'refs/heads/master'
id: file_changes
run: |
git add -A
if git diff-index --quiet --cached HEAD --; then
echo "should_submit=false" >> "$GITHUB_OUTPUT"
else
echo "should_submit=true" >> "$GITHUB_OUTPUT"
fi
- name: Submit PR if mdl changes files
if: false
#if: steps.file_changes.outputs.should_submit == 'true' && github.ref == 'refs/heads/master'
uses: peter-evans/create-pull-request@v6
with:
commit-message: "MarkdownLint auto fix from GitHub Actions run ${{ github.run_number }}"
assignees: "${{ github.actor }}"
branch: mdl-auto-fix
delete-branch: true
title: "Fix MarkdownLint formatting from GitHub Actions run ${{ github.run_number }}"
body: |
Attempt to automatically fix MarkdownLint formatting issues in ${{ github.sha }}.
This PR is generated by GitHub Actions [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). Please choose **Squash and Merge** for this PR.
- name: Build docs
run: |
mkdocs -v build
: > site/.nojekyll
echo -n '201.ustclug.org' > site/CNAME
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/master'
run: |
CINFO="$(git log -1 --pretty="%an: [%h] %s")"
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