Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

JReleaser

Janne Valkealahti edited this page Jan 6, 2024 · 4 revisions

This page contains info about JReleaser we use during a build. JReleaser is used for both snapshots are releases. Main difference is that as JReleaser is meant for a production tool it will skip some publishing parts for snapshots.

Create GitHub PAT

Use fine grained PAT to give access only to your own repos, then you’re not messing up anything in production. Needed permissions in fine grained PAT is read/write with Contents. With fine grained PAT only add target repos in your own account/org. Needed repos are:

  • spring-cli: clone repo

  • homebrew-spring-cli: create empty uninitialised repo

Running Locally

We don’t do releases locally but sometimes it’s convenient to try things out in your own system. Maybe you’re just trying things out or preparing to modify JReleaser scripts.

Prepare to Run JReleaser

JReleaser expects some things to exist, so run a build and setup jdks.

./gradlew build -x test
./gradlew -PcliRelease=true setupJdks
export JRELEASER_GITHUB_TOKEN=<PAT>

Run JReleaser

If current version is 0.7.1-SNAPSHOT, run snapshot release.

JRELEASER_PROJECT_VERSION=0.7.1-SNAPSHOT jreleaser assemble \
  --select-current-platform
JRELEASER_PROJECT_VERSION=0.7.1-SNAPSHOT jreleaser full-release \
  --select-current-platform \
  --dry-run

If you want to try GA release, change project version, build it and then you can use JRELEASER_PROJECT_VERSION=0.7.1. If you don’t use --dry-run option you should see GA release in your repo.

Running GH Actions in Clones

PAT you’ve created needs to go in into repository secret as JRELEASER_GITHUB_TOKEN. Then you can run snapshot or release builds from any branch.

Testing Artifacts

Environments

For Windows https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/ provides good images for getting vm’s up and running quickly. For MacOS https://github.com/myspaghetti/macos-virtualbox has a nice way to setup vm on a Linux.

Homebrew

We’re running in a container which can be thrown away. Prepare a container:

docker run --name jr-ubuntu-1804-brew -d -t ubuntu:18.04
docker exec -it jr-ubuntu-1804-brew bash

apt update
apt install -y git curl gcc

Install brew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /root/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

Install spring-cli(brew tap would be under your or official repo):

brew tap jvalkeal/spring-cli
brew install spring-cli

You should have spring command.

Clone this wiki locally