@@ -22,11 +22,13 @@ jobs:
22
22
build :
23
23
runs-on : ubuntu-latest
24
24
steps :
25
- - uses : actions/checkout@v4
25
+ - name : Checkout main branch
26
+ uses : actions/checkout@v4
26
27
with :
27
28
fetch-depth : 0
28
29
29
- - uses : actions/checkout@v4
30
+ - name : Checkout docs branch
31
+ uses : actions/checkout@v4
30
32
with :
31
33
ref : docs
32
34
path : mkdocs
@@ -41,19 +43,27 @@ jobs:
41
43
42
44
- name : Configure Git Credentials
43
45
run : |
44
- git config user.name github-actions[bot]
45
- git config user.email 41898282+github-actions[bot]@users.noreply.github.com
46
+ git config --global user.name github-actions[bot]
47
+ git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
46
48
47
- - uses : actions/setup-python@v5
49
+ - name : Setup Python
50
+ uses : actions/setup-python@v5
48
51
with :
49
52
python-version : 3.x
50
53
51
- - run : echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
54
+ - name : Restore pip cache
55
+ uses : actions/cache@v4
56
+ with :
57
+ path : ~/.cache/pip
58
+ key : ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
59
+ restore-keys : |
60
+ ${{ runner.os }}-pip-
52
61
53
- - uses : actions/cache@v4
62
+ - name : Restore mkdocs-material cache
63
+ uses : actions/cache@v4
54
64
with :
55
- key : mkdocs-material-${{ env.cache_id }}
56
65
path : .cache
66
+ key : mkdocs-material-${{ env.cache_id }}
57
67
restore-keys : |
58
68
mkdocs-material-
59
69
@@ -67,14 +77,15 @@ jobs:
67
77
- name : Set MKDOCS_API_KEYS
68
78
run : echo "MKDOCS_API_KEYS=${{ secrets.MKDOCS_API_KEYS }}" >> $GITHUB_ENV
69
79
70
- - run : |
80
+ - name : Build site
81
+ run : |
71
82
python3 main.py
72
83
mkdocs build -f mkdocs.yml
73
84
mkdocs build -f mkdocs-en.yml
74
85
75
86
- name : Generate CNAME
76
87
run : echo "leetcode.doocs.org" > ./site/CNAME
77
-
88
+
78
89
- name : Commit committer cache to docs branch
79
90
if : github.ref == 'refs/heads/main'
80
91
env :
92
103
cp "$CACHE_FILE" docs-cache/
93
104
94
105
cd docs-cache
106
+ git config user.name github-actions[bot]
107
+ git config user.email 41898282+github-actions[bot]@users.noreply.github.com
108
+
95
109
git add .git-committers-cache.json
96
110
git commit -m "chore: update committer cache [skip ci]" || echo "No changes to commit"
97
111
git push origin docs
0 commit comments