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 Pages And Sync to Gitee | |
# 触发条件:在 push 到 master 分支后 | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: # 下列文件的变更不触发部署 | |
- LICENSE | |
# 任务 | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest #部署运行环境搭建 | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@main | |
with: | |
persist-credentials: false | |
fetch-depth: 0 #github代码拉取深度 | |
- name: Setup Node 🎬 | |
uses: actions/setup-node@main | |
with: | |
node-version: "lts/*" | |
- name: Build 🔧 | |
run: | | |
yarn | |
yarn run build | |
ls -lrth | |
# - name: 📲 Push To GitHub Pages | |
# uses: ftnext/[email protected] | |
# with: | |
# build_dir: dist | |
# github_token: ${{ secrets.ZERDOCS_DEPLOY_TOKEN }} | |
# - name: Mirror the Github organization repos to Gitee. | |
# uses: Yikun/hub-mirror-action@master | |
# with: | |
# src: github/fxzer | |
# dst: gitee/fxzer | |
# dst_key: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} | |
# dst_token: ${{ secrets.MIRROR_REPO }} | |
# account_type: org | |
# src_account_type: org | |
# dst_account_type: org | |
# - name: 🔁 Sync to Gitee #同步到Gitee | |
# uses: wearerequired/git-mirror-action@master | |
# env: | |
# # 注意在此项目的 Settings->Actions-> Secrets 配置 GITEE_RSA_PRIVATE_KEY | |
# 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 #触发Gitee自动部署 | |
# uses: yanglbme/gitee-pages-action@master | |
# with: | |
# # 注意替换为你的 Gitee 用户名 | |
# gitee-username: fxzer | |
# # 注意在 Settings->Secrets 配置 GITEE_PASSWORD | |
# gitee-password: ${{ secrets.GITEE_PASSWORD }} | |
# # 注意替换为你的 Gitee 仓库 | |
# # 坑点:https://gitee.com/fxzer/zerdocs -->则填:fxzer/zerdocs,注意仓库名和路径名不一致问题 | |
# gitee-repo: fxzer/zerdocs | |
# # 要部署的分支 | |
# branch: gh-pages | |
# - name: Deploy 🚀 #把打包后的dist文件部署到master分支 | |
# uses: JamesIves/[email protected] | |
# with: | |
# token: ${{ secrets.ZERDOCS_DEPLOY_TOKEN }} #在本项目-->设置-->secrets添加 ZERDOCS_DEPLOY_TOKEN 变量 值为生成的秘钥 | |
# branch: gh-pages | |
# folder: dist |