From b43ca077224a8f29bfee92fbb0c0465f614a23ac Mon Sep 17 00:00:00 2001 From: Kas-tle <26531652+Kas-tle@users.noreply.github.com> Date: Thu, 3 Dec 2020 18:12:41 -0800 Subject: [PATCH] Automate building with Maven action --- .github/workflows/maven.yml | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/maven.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..e47f744 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,53 @@ +# 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 }}