# This workflow will build a Java project with Maven # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven name: Java CI with Maven on: push: tags: - '*' pull_request: branches: [ master ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - name: Get version information id: version uses: ncipollo/semantic-version-action@v1 - name: Set up JDK 8 uses: actions/setup-java@v1 with: java-version: 8 - name: Cache Maven packages uses: actions/cache@v1 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - name: Build with Maven env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: mvn -B package --file pom.xml - run: mkdir staging && cp target/*.jar staging - name: Generate release diff env: BEGIN_COMMIT: ${{ steps.version.outputs.previous_tag }} END_COMMIT: ${{ steps.version.outputs.tag }} run: git fetch --tags --force && git log --pretty=format:"* %s (%h)" ${BEGIN_COMMIT}..${END_COMMIT} > release_notes.md - name: Create release uses: ncipollo/release-action@v1 with: artifacts: staging/* allowUpdates: true bodyFile: "release_notes.md" draft: false prerelease: false token: ${{ secrets.GITHUB_TOKEN }}