build.yml 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. name: Build and Deploy
  2. on:
  3. push:
  4. branches: [ "main" ]
  5. pull_request:
  6. branches: [ "main" ]
  7. jobs:
  8. build-and-deploy:
  9. runs-on: ubuntu-latest
  10. environment:
  11. name: github-pages
  12. steps:
  13. - name: Checkout
  14. uses: actions/checkout@v3
  15. - name: Setup Node.js environment
  16. uses: actions/[email protected]
  17. with:
  18. node-version: "12.x"
  19. - name: Cache dependencies
  20. id: cache-node-modules
  21. uses: actions/cache@v3
  22. env:
  23. cache-name: cache-node-modules
  24. with:
  25. path: ./node_modules
  26. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package.json') }}
  27. - if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
  28. name: Install dependencies
  29. continue-on-error: true
  30. run: npm install
  31. - name: Build
  32. run: npm run docs:build
  33. - name: Deploy
  34. uses: peaceiris/actions-gh-pages@v3
  35. with:
  36. deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
  37. publish_dir: ./docs/.vuepress/dist