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: Deploy GitHub/Gitee Pages And Sync to Gitee | |
# 触发条件:在 push 到 master 分支后 | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: # 下列文件的变更不触发部署 | |
- LICENSE | |
# 任务 | |
jobs: | |
install-build-deploy-sync: | |
runs-on: ubuntu-latest # 部署运行环境搭建 | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: true | |
- name: Build Docs | |
run: pnpm build | |
- name: Deploy pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.DEPLOY_TOKEN }} | |
publish_dir: ./dist # 部署的目录 | |
user_name: github-actions[bot] | |
user_email: github-actions[bot]@users.noreply.github.com | |
# - name: Sync to Gitee | |
# uses: wearerequired/git-mirror-action@master | |
# env: | |
# # 注意在 Settings->Secrets 配置 GITEE_RSA_PRIVATE_KEY(复制本机生成的 ~/.ssh/gitee ) | |
# SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} | |
# with: | |
# # 注意替换为你的 GitHub 源仓库地址 | |
# source-repo: [email protected]:fxzer/zerdocs.git | |
# # 注意替换为你的 Gitee 目标仓库地址 | |
# destination-repo: [email protected]:fxzer/zerdocs.git | |
# - name: Build Gitee Pages | |
# uses: yanglbme/gitee-pages-action@main | |
# with: | |
# # 注意替换为你的 Gitee 用户名 | |
# gitee-username: fxzer | |
# # 注意在 Settings->Secrets 配置 GITEE_PSWD | |
# gitee-password: ${{ secrets.GITEE_PSWD }} | |
# # 注意替换为你的 Gitee 仓库,仓库名严格区分大小写,请准确填写,否则会出错 | |
# gitee-repo: fxzer/zerdocs | |
# # 要部署的分支,默认是 master,若是其他分支,则需要指定(指定的分支必须存在) | |
# branch: gh-pages |