feat:项目优化 #93
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
# 将静态内容部署到 GitHub Pages 的简易工作流程 | |
name: Deploy static content to Pages | |
on: | |
# 仅在推送到默认分支时运行。 | |
push: | |
branches: [ 'master' ] | |
# 这个选项可以使你手动在 Action tab 页面触发工作流 | |
workflow_dispatch: | |
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages。 | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# 允许一个并发的部署 | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: true | |
jobs: | |
# 任务ID | |
build-and-deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# 运行环境 | |
runs-on: ubuntu-latest | |
# 步骤 | |
steps: | |
# 官方action,将代码拉取到虚拟机 | |
- name: Checkout ️ | |
uses: actions/checkout@v3 | |
- name: Install and Build # 安装依赖、打包,如果提前已打包好无需这一步 | |
run: | | |
npm install | |
npm run build | |
- name: Deploy # 部署 | |
uses: JamesIves/[email protected] | |
with: | |
GITHUB_TOKEN: ${{ secrets.All }} | |
branch: gh-pages # 部署后提交到那个分支 | |
folder: dist # 这里填打包好的目录名称 | |