因为我的个博客使用的Netlify,这个服务给我的各方面印象都还不错,所以数字花园也索性一起发布在了这个上面。

结合之前发布11ty博客的方法,我同样通过Github Action完成了部署操作。

流程介绍:

  • 设置node版本
  • 运行 yarn install
  • 运行build命令
  • 将生成的文件部署到Netlify中。
name: Build and Test
 
on:
  pull_request:
    branches:
      - v4
  push:
    branches:
      - v4
 
jobs:
  build_deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
 
      - name: Set Node.js 20.x
        uses: actions/setup-node@master
        with:
          node-version: 20.x        
 
      - name: Run install
        uses: borales/actions-yarn@v4
        with:
          cmd: install # will run `yarn install` command
 
      - name: Build production bundle
        uses: borales/actions-yarn@v4
        with:
          cmd: build # will run `yarn prod` command
 
 
      - name: Deploy to Netlify
        uses: netlify/actions/cli@master
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
          build_directory: public
        with:
          args: deploy --prod