-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6 Publish releases to Maven Central via OSSRH (OSS Repository Hosting)
- Loading branch information
1 parent
70a53e7
commit 008c48a
Showing
5 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This workflow will build a package using Gradle and then publish it to OSSRH when a release is created | ||
# For more information see: https://github.com/actions/setup-java#publishing-using-gradle | ||
|
||
name: Publish to OSSRH when released | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up JDK 1.8 (Current LTS Release) | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
|
||
- name: Extract secring.gpg to sign files | ||
run: echo -n $SECRING_GPG | base64 --decode > micronaut-camunda-bpm-feature/secring.gpg | ||
env: | ||
SECRING_GPG: ${{ secrets.SECRING_GPG }} | ||
|
||
# The GITHUB_REF tag comes in the format 'refs/tags/v0.0.1'. If we split on '/' and take the 3rd value, we can get the release version, e.g. v.0.0.1 | ||
# We then remove the leading "v", e.g. 0.0.1 | ||
- name: Build release based on tag and publish to OSSRH | ||
run: | | ||
echo "${GITHUB_ACTOR} is publishing tag ${GITHUB_REF}." | ||
echo "${GITHUB_REF}" | cut -d "/" -f3 | grep --regexp '^v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+$' > /dev/null #Validate format with regular expression | ||
RELEASE_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3 | sed 's/v//') | ||
echo "New release version: ${RELEASE_VERSION}" | ||
./gradlew -Pversion=${RELEASE_VERSION} build --warning-mode=fail | ||
./gradlew -Pversion=${RELEASE_VERSION} -Psigning.password=${SIGNING_PWD} publish --info | ||
env: | ||
OSSRH_PWD: ${{ secrets.OSSRH_PWD }} | ||
SIGNING_PWD: ${{ secrets.SIGNING_PWD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# The project property 'version' is overwritten via .github/workflows/publish-release.yml | ||
version=0.0.1-SNAPSHOT | ||
micronautVersion=1.3.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ plugins { | |
id "application" | ||
} | ||
|
||
version "0.0.1-SNAPSHOT" | ||
group "info.novatec" | ||
|
||
configurations { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
plugins { | ||
id "application" | ||
id "maven-publish" | ||
id "signing" | ||
} | ||
|
||
version "0.0.1-SNAPSHOT" | ||
group "info.novatec" | ||
|
||
configurations { | ||
|
@@ -53,3 +54,50 @@ java { | |
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
// based on https://docs.gradle.org/current/userguide/publishing_maven.html#sec:modifying_the_generated_pom and https://central.sonatype.org/pages/requirements.html#sufficient-metadata | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
pom { | ||
name = 'micronaut-camunda-bpm-feature' | ||
description = 'Integration between Micronaut and Camunda BPM Process Engine' | ||
url = 'https://github.com/NovatecConsulting/micronaut-camunda-bpm' | ||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
developers { | ||
developer { | ||
name = 'The micronaut-camunda-bpm Team at Novatec Consulting GmbH' | ||
email = '[email protected]' | ||
organization = 'Novatec Consulting GmbH' | ||
organizationUrl = 'https://www.novatec-gmbh.de' | ||
} | ||
} | ||
scm { | ||
connection = 'scm:git:https://github.com/NovatecConsulting/micronaut-camunda-bpm.git' | ||
developerConnection = 'scm:git:https://github.com/NovatecConsulting/micronaut-camunda-bpm.git' | ||
url = 'https://github.com/NovatecConsulting/micronaut-camunda-bpm' | ||
} | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
url = version.endsWith('SNAPSHOT') ? 'https://oss.sonatype.org/content/repositories/snapshots/' : 'https://oss.sonatype.org/service/local/staging/deploy/maven2' | ||
credentials { | ||
username 'micronaut-camunda' | ||
password "$System.env.OSSRH_PWD" | ||
} | ||
} | ||
} | ||
} | ||
|
||
// see https://docs.gradle.org/current/userguide/signing_plugin.html#sec:specifying_what_to_sign and https://central.sonatype.org/pages/working-with-pgp-signatures.html#generating-a-key-pair | ||
signing { | ||
sign publishing.publications.mavenJava | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# see https://docs.gradle.org/current/userguide/signing_plugin.html#signing_plugin | ||
# The project property 'signing.password' is set via .github/workflows/publish-release.yml | ||
signing.keyId=2A0D5A78 | ||
signing.secretKeyRingFile=secring.gpg | ||
#signing.password= |