name: deploy

on:
    push:
        branches: [ master ] # master 分支有 push 时触发

jobs:
    deploy:
        runs-on: ubuntu-latest
        steps:
            -   uses: actions/checkout@v2

            -   name: Setup Node.js v14.x
                uses: actions/setup-node@v1
                with:
                    node-version: '14.x'

            -   name: Install
                run: npm install # 安装依赖

            -   name: Build
                run: npm run build # 打包

            -   name: Deploy
                uses: peaceiris/actions-gh-pages@v3 # 使用部署到 GitHub pages 的 action
                with:
                    publish_dir: ./dist # 部署打包后的 dist 目录
                    github_token: ${{ secrets.VUE3_DEPLOY }} # secret 名
                    user_name: ${{ secrets.MY_USER_NAME }}
                    user_email: ${{ secrets.MY_USER_EMAIL }}
                    commit_message: Update Vite2.x + Vue3.x + TypeScript Starter # 部署时的 git 提交信息，自由填写
