name: CI
on:
  push:
    branches: [ main ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Import GPG Key
        uses: crazy-max/ghaction-import-gpg@v1
        env:
           GPG_PRIVATE_KEY: ${{ secrets.GPG_SECRET_KEY }}
           PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
      - name: Set up JDK 11
        uses: actions/setup-java@v2
        with:
          java-version: '11'
          distribution: 'temurin'
      - name: Build with Maven
        run: ./mvnw -B package

name: CI
on:
  push:
    branches: [ main ]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Import GPG Key
        uses: crazy-max/ghaction-import-gpg@v1
        env:
           GPG_PRIVATE_KEY: ${{ secrets.GPG_SECRET_KEY }}
           PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
      - name: Set up JDK 11
        uses: actions/setup-java@v2
        with:
          java-version: '11'
          distribution: 'temurin'
      - 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: Build with Maven
        run: ./mvnw -B package

Add Maven dependencies cache to GitHub Actions workflow
Add Maven dependencies cache to GitHub Actions workflow