2023-11-25 14:04 #510
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
name: Publish Gitee Pages | |
on: | |
push: | |
branches: [master] | |
paths-ignore: | |
- .github/workflows/gh-pages.yml | |
# Cancel any in-progress job or run | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency | |
concurrency: | |
group: gitee-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
gitee-pages: | |
name: Publish Gitee Pages | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
# Required by sphinx-notes@pages | |
fetch-depth: 0 | |
- name: Setup locale | |
run: | | |
sudo locale-gen en_US.UTF-8 | |
sudo update-locale | |
- name: Install dependencies | |
uses: awalsh128/cache-apt-pkgs-action@v1.2.0 | |
with: | |
packages: lilypond timidity imagemagick fonts-noto-cjk graphviz plantuml ffmpeg wget | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
- name: Build and Commit | |
uses: sphinx-notes/pages@v2 | |
with: | |
documentation_path: . | |
requirements_path: ./requirements.txt | |
target_branch: gitee-pages | |
- name: Replace Gitee Denied Pages | |
run: | | |
wget https://gist.githubusercontent.com/SilverRainZ/0b3388d17ea1ca02b5b749d0a56ed534/raw/{page.html,list.txt} | |
for i in $(cat list.txt); do | |
cp page.html $i | |
done | |
rm page.html list.txt | |
git add . | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git commit --allow-empty -m "Replace gitee denied pages" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gitee-pages | |
- name: Mirror to Gitee | |
uses: SilverRainZ/mirror-action@master | |
with: | |
REMOTE: git@gitee.com:silverrainz/silverrainz.git | |
GIT_SSH_PRIVATE_KEY: ${{ secrets.GITEE_TOKEN }} | |
GIT_SSH_NO_VERIFY_HOST: "true" | |
PUSH_ALL_REFS: "false" | |
GIT_PUSH_ARGS: "--force --prune" # Don't push tags, Dont' force push | |
GIT_REF: gitee-pages | |
- name: Trigger Gitee Pages Rebuild | |
uses: yanglbme/gitee-pages-action@main | |
with: | |
gitee-username: SilverRainZ | |
gitee-password: ${{ secrets.GITEE_PASSWORD }} | |
gitee-repo: silverrainz/silverrainz | |
branch: gitee-pages |