Skip to content

Automatically build your Java Project and release all the related JARs.

Notifications You must be signed in to change notification settings

fulminazzo/java-automatic-release

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Automatic Release

Automatic Release is a composite GitHub Action that joins together multiple actions to automate your project releases.

Starting from version v3, it is now REQUIRED to prepend !release before the commit message for any commit that you want released.

It does so by:

  • setting up Java to the specified version in with.java-version;
  • find out what build tool you are using:
    • if you are using Maven, it loads the project variables (version and modules) from your pom.xml file and builds it using mvn package;
    • if you are using Gradle, it loads the project variables from both your build.gradle and settings.gradle files and builds it using ./gradlew build;
    • if you are using none of the above, the action fails (Apache Ant is NOT supported).
  • finally, it uses the previous loaded variables to create a new release with tag $VERSION and uses your $COMMIT_MESSAGE as the description. Every file found during the compilation process will be published.

To start using it, create a new workflow and insert the following:

# Name of the action
name: Automatic Release

# Event to run on
on:
  # Will run on every push in the "main" or "master" branch
  push:
    branches:
      - main
      - master

permissions:
  contents: write

# Jobs that will execute
jobs:
  release:
    name: Setup Environment, Build JAR and Release Project
    runs-on: ubuntu-latest
    if: "startsWith(github.event.head_commit.message, '!release')"
    steps:
      - name: Automatic Release
        uses: Fulminazzo/java-automatic-release@v3
        with:
          java-version: 8
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          REPOSITORY_NAME: ${{ github.event.repository.name }}
          # Message specified in the commit
          COMMIT_MESSAGE: ${{ github.event.head_commit.message }}

About

Automatically build your Java Project and release all the related JARs.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages