openapi-style-validator
openapi-style-validator copied to clipboard
Create a github action that release on Maven when we create a tag
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.
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 e700b5f5b3afd0464e91fa2bfcdcd8abdb4fbbf9
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 0dcdfd5d8b0daef2f3e5192add43e2bbd980cb48
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
Closebutton - Wait until the operation is done
- Click on the
Releasebutton
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.
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