优化GitHub Actions工作流,更新Node.js设置,添加依赖安装和构建步骤 #21
This file contains hidden or 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
| name: Build and Deploy | |
| on: [push] | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@master | |
| with: | |
| # fetch all commits to get last updated time or other git log info | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 12 | |
| - name: Install deps | |
| run: yarn | |
| - name: Build VuePress site | |
| run: yarn build | |
| # please check out the docs of the workflow for more details | |
| # @see https://github.com/crazy-max/ghaction-github-pages | |
| - name: Deploy to GitHub Pages | |
| uses: crazy-max/ghaction-github-pages@v4 | |
| with: | |
| target_branch: gh-pages | |
| build_dir: docs/.vuepress/dist/ | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |