Skip to content

Create a github action that release on Maven when we create a tag #276

Open

Description

@JFCote

The goal of this task is to automate an event when someone creates a tag.
As soon as the tag is created, the associated github action is started and all the steps of a release would be automatically done.
Minutes later, we would have access to the latest version on Maven.

First step is to retrieve the step of the release process from @jmini and to code them in a github action script. Then, get the proper access and put them in the secrets. Then testing with a real release.

Activity

  1. jmini commented on May 5, 2022

    @jmini
    Member

    To create a release:

    1) Set the credentials to be able to push to nexus:

    export SONATYPE_USER=<user name (best is to use a token)>
    export SONATYPE_PASSWORD=<password (best is to use a token)>
    

    2) Change the version and commit.

    2a) change the version from a.b-SNAPSHOT to a.b => Example e700b5f

    When commit (2a) is created, run ./gradlew publishToSonatype
    Create tag a.b on commit (2a) and push it.

    2b) change the version from a.b to a.(b+1)-SNAPSHOT => Example 0dcdfd5

    For this complete 2) bock an alternative is to use the plugin id 'net.researchgate.release' version '2.6.0'
    Check the project https://github.com/OpenAPITools/empoa/

    Then the plugin is performing the same step when running ./gradlew release -Prelease.useAutomaticVersion=true

    3) Activities in Nexus

    In the Staging Repositories (https://oss.sonatype.org/#stagingRepositories)

    Select the corresponding repository (example orgopenapitools-1292)
    Check the content (uploaded jars, pom files)

    • Click on the Close button
    • Wait until the operation is done
    • Click on the Release button

    It is also possible to automate those steps inside the gradle plugin (probably nexus publishing).
    I like checking manually before publishing.

    4) Other prerequite

    You need to be able to sign (GPG) your jars and upload the signature to Nexus.
    Everything is prepared with apply plugin: 'signing'

    But you need to have the infrastructure available on the build machine.

  2. wing328 commented on Mar 18, 2023

    @wing328
    Member

    FYI. To sign the JAR, run the following:

    ./gradlew publishToSonatype -Psigning.gnupg.keyName=3E99C7FD4C83EB0E56D5503678737DD36C998877
    

    where 3E99C7FD4C83EB0E56D5503678737DD36C998877 is the key name one can find from gpg --list-key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions