Skip to content

Instantly share code, notes, and snippets.

@aalmiray
Last active September 13, 2022 22:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aalmiray/465ea6c195f23ba859c2422dcd75b0b3 to your computer and use it in GitHub Desktop.
Save aalmiray/465ea6c195f23ba859c2422dcd75b0b3 to your computer and use it in GitHub Desktop.
JReleaser Workshop

Install

  1. The preferred choice is via sdkman: sdk install jreleaser
  2. Other choices available explained at https://github.com/jreleaser/jreleaser
  3. Depending of your choice you may need Java preinstalled (Java 8+)
  4. Verify the installation by invoking jreleaser -V. It should be version 1.2.0
  5. Also install 1.1.0 by invoking sdk install jreleaser 1.1.0.

GitHub setup

  1. A GitHub accout is required
  2. Create a personal access token as explained at https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
  3. Select all permissions for read/write, we need them posting to additional repositories. Also select discussions if you'd like to post announcements to the Discussions tab.
  4. Save the token in a file ~/.jreleaser/config.properties (Linux/Mac) or %USER_HOME%/.jreleaser/config.properties (Windows)
  5. The content of this file should look like JRELEASER_GITHUB_TOKEN = toke_value.

1. Auto config Release

  1. Open a terminal/shell
  2. Fork https://github.com/aalmiray/app/
  3. Clone your forked repository into your local environment
  4. Change directory into the clone directory
  5. !! Use JReleaser 1.1.0 !!
  6. Issue the following command jreleaser release --auto-config --project-version 1.0.0
  7. Build the binaries by invoking ./mvnw verify
  8. Play around with different options. Invoke jreleaser release -h and look for options at the Auto Config section

2. Configured Release

  1. Open the jreleaser.yml file
  2. Observe configured values for each section
  3. If you have not yet build the binaries do so by invoking ./mvnw verify
  4. Configure an enviromnet variable JRELEASER_PROJECT_VERSION with 1.0.0 as value
    • alternatively edit jreleaser.yml and set version: 1.0.0 in the project: section
  5. Disable the sign property on the release: section.
  6. Set the active: property of the signing: section to "never"
  7. Browse to the project settings on GitHub, activate discussions by ticking the checkbox
  8. !! Use JReleaser 1.2.0 !!
  9. Make a full release (git release + homebrew formula) with jreleaser full-release
  10. Browse to GitHub and look for the freshly posted relase in your fork
  11. Browse to <your-github-user>/homebrew-tap and inspect the generated Formula
  12. [optional] If you're running Linux/Mac and have hombrew installed then invoke: brew tap <your-github-user>/tap && brew install app

3. Releasing with Maven

  1. Edit the pom.xml file and add the following plugin
    <plugin>
        <groupId>org.jreleaser</groupId>
        <artifactId>jreleaser-maven-plugin</artifactId>
        <version>1.2.0</version>
    </plugin>
  1. Print out the current configuration with ./mvnw jreleaser:config
  2. Post a release with ./mvnw jreleaser:release
  3. Play around with options (use jreleaser.yml as inspiration)
  4. Full docs at https://jreleaser.org/guide/latest/configuration/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment