name: Build

on:
  push:
    branches: [ master ]
    paths-ignore:
      - "doc/**"
      - "**/README.md"
  pull_request:
    branches: [ master ]
    paths-ignore:
      - "doc/**"
      - "**/README.md"

jobs:
  build:
    if: "!contains(github.event.head_commit.message, '[skip ci]')" # 如果 commit 信息包含以下关键字则跳过该任务
    runs-on: ubuntu-latest
    env:
      KEY: ${{ secrets.WEB_HOOK_ACCESS_KEY }}

    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8

      - name: Cache local Maven repository
        uses: actions/cache@v2
        with:
          path: ~/.m2/repository
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-

      - name: Unit Test
        run: mvn package -B -pl blog-deploy -am
