-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38f3e06
commit c400c3c
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Update Wiki | ||
|
||
on: | ||
push: | ||
# paths: | ||
# - docs/** | ||
branches: | ||
- main | ||
env: | ||
USER_TOKEN: ${{ secrets.WIKI_ACTION_TOKEN }} # This is the repository secret | ||
USER_NAME: wiki-bot | ||
USER_EMAIL: [email protected] | ||
OWNER: SwanHubX | ||
REPOSITORY_NAME: SwanLab-Toolkit | ||
|
||
jobs: | ||
publish_docs_to_wiki: | ||
name: Publish docs to Wiki | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
# 1. Create folder named `tmp_wiki` | ||
# 2. Initialize Git | ||
# 3. Pull old Wiki content | ||
- name: Pull content from wiki | ||
run: | | ||
mkdir tmp_wiki | ||
cd tmp_wiki | ||
git init | ||
git config user.name $USER_NAME | ||
git config user.email $USER_EMAIL | ||
git pull https://[email protected]/$OWNER/$REPOSITORY_NAME.wiki.git | ||
# 4. Synchronize differences between `docs` & `tmp_wiki` | ||
# 5. Push new Wiki content | ||
- name: Push content to wiki | ||
run: | | ||
rsync -av --delete docs/ tmp_wiki/ --exclude .git | ||
cd tmp_wiki | ||
git add . | ||
git commit -m "Update Wiki content" | ||
git push -f --set-upstream https://[email protected]/$OWNER/$REPOSITORY_NAME.wiki.git master |