name: SmallTown Actions Test on: push: branches: - master jobs: my_first_job: name: Build_Site runs-on: ubuntu-latest env: BUILD_FLAG: 'exec_build' steps: - name: Checkout uses: actions/checkout@v2.4.0 # 检查最新 git 提交的信息,输出结果,并将其设置为 outputs.needbuild 属性 - name: Get commit message id: judge_buildornot run: echo "::set-output name=needbuild::$(git log -1 --pretty='%s' | cut -f1 -d ' ')" - name: 🛑 not need build, end! continue-on-error: true if: steps.judge_buildornot.outputs.needbuild != env.BUILD_FLAG run: echo "CommitMsg begin with [${{steps.judge_buildornot.outputs.needbuild}}], not match:[${{env.BUILD_FLAG}}] so don't need to build and deploy." #设置 node 环境 - name: Setup Node ENV if: steps.judge_buildornot.outputs.needbuild == env.BUILD_FLAG uses: actions/setup-node@v2 with: node-version: '14' cache: 'npm' - name: Install Depencencies And Build if: steps.judge_buildornot.outputs.needbuild == env.BUILD_FLAG run: | npm install npm run build - name: 👀 dist folder if: steps.judge_buildornot.outputs.needbuild == env.BUILD_FLAG run: ls dist - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@4.1.7 if: steps.judge_buildornot.outputs.needbuild == env.BUILD_FLAG with: branch: gh-pages folder: dist