build.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # This is a basic workflow to help you get started with Actions
  2. name: Build and deploy
  3. # Controls when the action will run.
  4. on:
  5. # Triggers the workflow on push or pull request events but only for the main branch
  6. push:
  7. branches: [ main ]
  8. # Allows you to run this workflow manually from the Actions tab
  9. workflow_dispatch:
  10. # A workflow run is made up of one or more jobs that can run sequentially or in parallel
  11. jobs:
  12. # This workflow contains a single job called "build"
  13. build:
  14. # The type of runner that the job will run on
  15. runs-on: ubuntu-latest
  16. # Steps represent a sequence of tasks that will be executed as part of the job
  17. steps:
  18. # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
  19. - uses: actions/checkout@v2
  20. - name: Use Node.js
  21. uses: actions/[email protected]
  22. with:
  23. node-version: "12.x"
  24. # 如果缓存没有命中,安装依赖,根据实际来改,也可以是npm,这里是用的yarn
  25. - name: Install dependencies And Build
  26. run: npm install && npm run docs:build
  27. - name: Deploy
  28. uses: JamesIves/github-pages-deploy-action@releases/v3
  29. with:
  30. ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
  31. # 部署到 gh-pages 分支
  32. BRANCH: gh-pages
  33. # 部署目录为 VuePress 的默认输出目录,这里需要根据项目的目录进行修改
  34. FOLDER: docs/.vuepress/dist