Skip to content

feat: ✨ 添加代码编辑器组件 #29

feat: ✨ 添加代码编辑器组件

feat: ✨ 添加代码编辑器组件 #29

Workflow file for this run

# .github/workflows/auto-deploy.yml
name: auto deploy 🚀
on:
# 监听push操作
push:
branches:
- main # 这里只配置了main分支,所以只有推送main分支才会触发以下任务
pull_request:
# 这个选项可以使你手动在 Action tab 页面触发工作流
# workflow_dispatch:
permissions:
# 允许对仓库的内容进行写操作。包括创建、修改和删除文件、目录以及提交更改等
# 这里只配置了push,所以只有推送main分支才会触发以下任务
contents: write
# 允许管理 GitHub Pages 服务并对其进行写操作
pages: write
jobs:
# 任务ID
build-and-deploy:
# 运行环境
# runs-on: macos-latest
# runs-on: windows-latest
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# 步骤
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
# 打包-GitHub
- name: Build application 🔧
run: npm run build github
# 部署-GitHub
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
with:
token: ${{ secrets.MB_ADMIN_TOKEN }}
branch: gh-pages # default: gh-pages
folder: dist-github
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
- name: Build application
run: npm run build gitee
# 部署-Gitee
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
with:
token: ${{ secrets.MB_ADMIN_TOKEN }}
branch: gh-pages-gitee # default: gh-pages
folder: dist-gitee
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
env:
# 注意在 Settings->Secrets 配置 GITEE_RSA_PRIVATE_KEY
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
with:
# 注意替换为你的 GitHub 源仓库地址
source-repo: [email protected]:syh-micro-build/mb-admin.git
# 注意替换为你的 Gitee 目标仓库地址
destination-repo: [email protected]:shanyi-hui/mb-admin.git
- name: Build Pages
uses: yanglbme/gitee-pages-action@main
with:
# 注意替换为你的 Gitee 用户名
gitee-username: ShanYi-Hui
# 注意在 Settings->Secrets 配置 GITEE_PASSWORD
gitee-password: ${{ secrets.GITEE_PASSWORD }}
# 注意替换为你的 Gitee 仓库,仓库名严格区分大小写,请准确填写,否则会出错
gitee-repo: ShanYi-Hui/mb-admin
# 要部署的分支,默认是 master,若是其他分支,则需要指定(指定的分支必须存在)
branch: gh-pages-gitee
https: true