Skip to content

Maven Build and Release #10

Maven Build and Release

Maven Build and Release #10

Workflow file for this run

name: Maven Build and Release
on:
push:
tags: [ 'v*' ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
- name: Set RELEASE_VERSION from tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Print version
run: |
echo $RELEASE_VERSION
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: target
path: ${{ github.workspace }}/target/**/*
- name: Extract changelog content
run: |
sed -n "/^## \[$RELEASE_VERSION]/,/^## /p" CHANGELOG.md | sed '1d;$d' > changelog_body.md
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: changelog_body.md
draft: true
prerelease: false
files: |
target/minecraft-prometheus-exporter-*.jar
README.md
CHANGELOG.md
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}