Skip to content

Commit

Permalink
ci: 🎡 添加同步代码至 Gitee 并部署 Gitee pages
Browse files Browse the repository at this point in the history
之前错误原因是ssh私钥未复制全,私钥应包含开始与结束的分割线,还有同步代码的 action 今天抛锚了,换了一个 action,这次应该没问题了吧。。。
  • Loading branch information
ShanYi-Hui committed Apr 26, 2024
1 parent dcf07c1 commit 12cffac
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions .github/workflows/auto-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ jobs:
# 安装依赖
- name: Install dependencies
run: npm install
# 打包

# 打包-GitHub
- name: Build application 🔧
run: npm run build github

# 部署 https://github.com/JamesIves/github-pages-deploy-action
# 部署-GitHub
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
Expand All @@ -61,32 +62,12 @@ jobs:
clean: true # Automatically remove deleted files from the deploy branch
# commit-message: ${{ github.event.head_commit.message }} # default: `Deploying to gh-pages from @ 3238feb 🚀`
# commit-message: "deploy: ${{ github.sha }} (${{ github.event.head_commit.message }}) 🚀 "
sync-to-gitee:
# github 构建部署成功后触发
needs: build-and-deploy
runs-on: ubuntu-latest
steps:
# 官方action,将代码拉取到虚拟机
- name: Checkout
uses: actions/checkout@v4

# 建一个名为setup-node的步骤(安装指定版本的Node.js)
- name: setup-node
# 使用setup-node@v3这个action
uses: actions/setup-node@v4
# 指定某个action 可能需要输入的参数
with:
node-version: '18.12.1'

# 安装依赖
- name: Install dependencies
run: npm install

# 打包
# 打包-Gitee
- name: Build application
run: npm run build gitee

# 部署 https://github.com/JamesIves/github-pages-deploy-action
# 部署-Gitee
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
Expand All @@ -97,7 +78,12 @@ jobs:
clean: true # Automatically remove deleted files from the deploy branch
# commit-message: ${{ github.event.head_commit.message }} # default: `Deploying to gh-pages from @ 3238feb 🚀`
# commit-message: "deploy: ${{ github.sha }} (${{ github.event.head_commit.message }}) 🚀 "

# 同步至 Gitee
sync-to-gitee:
# GitHub 构建部署成功后触发
needs: build-and-deploy
runs-on: ubuntu-latest
steps:
## 同步代码
- name: Sync Code # 名字随便起
uses: wearerequired/git-mirror-action@v1
Expand All @@ -118,7 +104,7 @@ jobs:
# 注意在 Settings->Secrets 配置 GITEE_PASSWORD
gitee-password: ${{ secrets.GITEE_PASSWORD }}
# 注意替换为你的 Gitee 仓库,仓库名严格区分大小写,请准确填写,否则会出错
gitee-repo: shanyi-hui/mb-admin
gitee-repo: ShanYi-Hui/mb-admin
# 要部署的分支,默认是 master,若是其他分支,则需要指定(指定的分支必须存在)
branch: gh-pages-gitee
https: true

0 comments on commit 12cffac

Please sign in to comment.