CustomDimensions/.github/workflows/maven.yml
2020-12-03 19:47:28 -08:00

57 lines
1.8 KiB
YAML

# 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 11
uses: actions/setup-java@v1
with:
java-version: 11
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x86 # (x64 or x86) - defaults to x64
- run: wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
- run: java -jar BuildTools.jar --rev 1.16.4
- 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 }}