Skip to main content
Configure MCReleaser to publish your artifacts to GitHub Releases.

Required Variables

GITHUB_TOKEN
string
required
The GitHub personal access token or GitHub Actions token used to authenticate with the GitHub API.The token needs the repo scope (or contents: write permission in GitHub Actions) to create releases.Example:
export GITHUB_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxx"
or with system properties:
java -DgithubToken="ghp_xxxxxxxxxxxxxxxxxxxx" -jar mcreleaser.jar
GitHub Actions:
env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY
string
required
The GitHub repository in the format owner/repo where the release will be created.Example:
export GITHUB_REPOSITORY="HSGamer/MCReleaser"
or with system properties:
java -DgithubRepository="HSGamer/MCReleaser" -jar mcreleaser.jar
GitHub Actions:
env:
  GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF
string
required
The Git reference (tag or branch) for the release. Typically this is a tag like v1.0.0 or refs/tags/v1.0.0.Example:
export GITHUB_REF="v1.0.0"
or with system properties:
java -DgithubRef="v1.0.0" -jar mcreleaser.jar
GitHub Actions:
env:
  GITHUB_REF: ${{ github.ref }}

Optional Variables

GITHUB_DRAFT
boolean
default:"false"
Whether to create the release as a draft. Draft releases are not visible to the public until published.Example:
export GITHUB_DRAFT=true
or with system properties:
java -DgithubDraft=true -jar mcreleaser.jar
GITHUB_PRERELEASE
boolean
default:"false"
Whether to mark the release as a prerelease. Prereleases are marked as “Pre-release” on GitHub and are not considered production-ready.Example:
export GITHUB_PRERELEASE=true
or with system properties:
java -DgithubPrerelease=true -jar mcreleaser.jar

Source Reference

GitHub properties are defined in:
/workspace/source/github/src/main/java/me/hsgamer/mcreleaser/github/GithubPropertyKey.java:7
public interface GithubPropertyKey {
    PropertyPrefix GITHUB = new PropertyPrefix("github");
    PropertyKey TOKEN = GITHUB.key("token");
    PropertyKey REPOSITORY = GITHUB.key("repository");
    PropertyKey REF = GITHUB.key("ref");
    PropertyKey DRAFT = GITHUB.key("draft");
    PropertyKey PRERELEASE = GITHUB.key("prerelease");
}

Complete Example

Using Environment Variables

export NAME="AwesomePlugin"
export VERSION="1.0.0"
export DESCRIPTION="Initial release with amazing features"
export GITHUB_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxx"
export GITHUB_REPOSITORY="username/awesome-plugin"
export GITHUB_REF="v1.0.0"
export GITHUB_DRAFT=false
export GITHUB_PRERELEASE=false

java -jar mcreleaser.jar

Using System Properties

java -Dname="AwesomePlugin" \
     -Dversion="1.0.0" \
     -Ddescription="Initial release with amazing features" \
     -DgithubToken="ghp_xxxxxxxxxxxxxxxxxxxx" \
     -DgithubRepository="username/awesome-plugin" \
     -DgithubRef="v1.0.0" \
     -DgithubDraft=false \
     -DgithubPrerelease=false \
     -jar mcreleaser.jar

GitHub Actions Workflow

name: Release

on:
  release:
    types: [created]

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Set up JDK
        uses: actions/setup-java@v4
        with:
          java-version: '17'
          distribution: 'temurin'
      
      - name: Build
        run: ./gradlew build
      
      - name: Release to GitHub
        env:
          NAME: ${{ github.event.repository.name }}
          VERSION: ${{ github.ref_name }}
          DESCRIPTION: ${{ github.event.release.body }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_REPOSITORY: ${{ github.repository }}
          GITHUB_REF: ${{ github.ref }}
        run: java -jar mcreleaser.jar

Tips

  • In GitHub Actions, use the built-in GITHUB_TOKEN secret for authentication
  • The GITHUB_REF value in GitHub Actions includes the full ref path (e.g., refs/tags/v1.0.0)
  • Draft releases are useful for testing the release process before making it public
  • Use prerelease for beta, alpha, or release candidate versions

Build docs developers (and LLMs) love