Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JFCote opened this issue Dec 8, 2021 · 2 comments
Open

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

JFCote opened this issue Dec 8, 2021 · 2 comments

Comments

@JFCote
Copy link
Member

JFCote commented Dec 8, 2021

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.

@jmini
Copy link
Member

jmini commented May 5, 2022

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.

@wing328
Copy link
Member

wing328 commented Mar 18, 2023

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

@wing328 wing328 mentioned this issue Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants