Skip to content

Maven Release

Maven Release #9

Workflow file for this run

name: Maven Release
on:
release:
types: [ published ]
jobs:
publish:
name: Build and Upload JARs
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
# This step changes the version in your pom.xml to match the release tag
# This change only happens in the workflow and is not committed to your repository.
# You could set the version in your repository to something like `0.0.0-SNAPSHOT` and
# it will always be overwritten to the correct version here when a release is created.
- name: Set maven project ver
run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false
# This step compiles your Maven project to a `.jar`
- name: Build and package Maven project
run: mvn -B package
# An optional step to also upload the `.jar` to the GitHub release assets
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
# Make sure that this matches the file name of your .jar
args: target/moreheadsounds-${{ github.event.release.tag_name }}.jar application/java-archive
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
# Upload the .jar to Modrinth
- name: Upload to Modrinth
uses: cloudnode-pro/[email protected]
with:
token: '${{ secrets.MODRINTH_TOKEN }}'
project: DL9cWKdP
file: 'target/moreheadsounds-${{ github.event.release.tag_name }}.jar'
changelog: '${{ github.event.release.body }}'
loaders: 'paper, purpur, spigot'