Skip to content

Commit 9f5eb11

Browse files
committed
update ci
1 parent e002508 commit 9f5eb11

1 file changed

Lines changed: 45 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,54 @@ on:
44
branches:
55
- master
66
- main
7-
permissions:
8-
contents: read
9-
pages: write
10-
id-token: write
7+
workflow_dispatch:
8+
119
jobs:
1210
deploy:
13-
environment:
14-
name: github-pages
15-
url: ${{ steps.deployment.outputs.page_url }}
1611
runs-on: ubuntu-latest
1712
steps:
18-
- uses: actions/configure-pages@v5
19-
- uses: actions/checkout@v5
20-
- uses: actions/setup-python@v5
13+
- name: Checkout Repo
14+
uses: actions/checkout@v5
15+
16+
- name: Configure Timezone
17+
run: |
18+
sudo timedatectl set-timezone "Asia/Shanghai"
19+
20+
- name: Setup Python
21+
uses: actions/setup-python@v5
2122
with:
2223
python-version: 3.x
23-
- run: pip install zensical
24-
- run: zensical build --clean
25-
- uses: actions/upload-pages-artifact@v4
26-
with:
27-
path: site
28-
- uses: peaceiris/actions-gh-pages@v4
29-
with:
30-
github_token: ${{ secrets.GITHUB_TOKEN }}
31-
publish_dir: ${{ github.workspace }}/site
24+
25+
- name: Install Dependencies
26+
run: |
27+
pip install zensical
28+
29+
- name: Build Documentation
30+
run: |
31+
zensical build --clean
32+
33+
- name: Configure Git
34+
env:
35+
DEPLOY_PRI: ${{ secrets.DEPLOY_PRI }}
36+
GIT_USERNAME: ${{ github.repository_owner }}
37+
GIT_EMAIL: ${{ github.repository_owner }}@user.github.com
38+
run: |
39+
mkdir -p ~/.ssh/
40+
echo "${DEPLOY_PRI}" > ~/.ssh/id_rsa
41+
chmod 600 ~/.ssh/id_rsa
42+
ssh-keyscan github.com >> ~/.ssh/known_hosts
43+
git config --global user.name "${GIT_USERNAME}"
44+
git config --global user.email "${GIT_EMAIL}"
45+
46+
- name: Commit Documentation File
47+
env:
48+
GIT_URL: 'git@github.com:licyk/SDNote.git'
49+
run: |
50+
git -C "${{ github.workspace }}/site" init
51+
git -C "${{ github.workspace }}/site" remote add origin "${GIT_URL}"
52+
git -C "${{ github.workspace }}/site" add -A
53+
git -C "${{ github.workspace }}/site" commit -m "Documentation auto generated. Time: $(date +'%Y-%m-%d %H:%M:%S')"
54+
55+
- name: Push Documentation File
56+
run: |
57+
git -C "${{ github.workspace }}/site" push origin HEAD:gh-pages --force

0 commit comments

Comments
 (0)