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

update publish process #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
run: ./gradlew publish
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ if (propertiesFile.exists()) {
properties.load(propertiesFile.newDataInputStream())
}

ext.nexusUsername = properties.getProperty('nexusUsername') != null ? properties.getProperty('nexusUsername') : System.getenv('NEXUS_USERNAME');
ext.nexusPassword = properties.getProperty('nexusPassword') != null ? properties.getProperty('nexusPassword') : System.getenv('NEXUS_PASSWORD');
ext.ossrhUsername = properties.getProperty('ossrhUsername') != null ? properties.getProperty('ossrhUsername') : System.getenv('OSSRH_USERNAME');
ext.ossrhPassword = properties.getProperty('ossrhPassword') != null ? properties.getProperty('ossrhPassword') : System.getenv('OSSRH_PASSWORD');

ext.signingKeyId = properties.getProperty('signingKeyId') != null ? properties.getProperty('signingKeyId') : System.getenv('SIGNING_KEY_ID');
ext.signingKey = properties.getProperty('signingKey') != null ? properties.getProperty('signingKey') : System.getenv('SIGNING_KEY');
Expand Down Expand Up @@ -74,7 +74,7 @@ allprojects {
def repoGroupIdVal = 'ai.kontent';

subprojects {
version = System.getenv('RELEASE_TAG') != null && !System.getenv('RELEASE_TAG').isEmpty() ? System.getenv('RELEASE_TAG') : '5.1.0-SNAPSHOT'
version = System.getenv('RELEASE_TAG') != null && !System.getenv('RELEASE_TAG').isEmpty() ? System.getenv('RELEASE_TAG') : '5.1.2'
ext.repoGroupId = repoGroupIdVal
group = repoGroupIdVal
ext.repositoryHost = 'maven.org'
Expand Down
5 changes: 3 additions & 2 deletions delivery-sdk-generators/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,16 @@ publishing {
}
repositories {
maven {
name = "OSSRH"
if (project.getVersion().toString().endsWith('SNAPSHOT')) {
url "https://s01.oss.sonatype.org/content/repositories/snapshots/"
} else {
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}

credentials {
username nexusUsername
password nexusPassword
username ossrhUsername
password ossrhPassword
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions delivery-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,15 @@ publishing {
}
repositories {
maven {
name = "OSSRH"
if (project.getVersion().toString().endsWith('SNAPSHOT')) {
url "https://s01.oss.sonatype.org/content/repositories/snapshots/"
} else {
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
}
credentials {
username nexusUsername
password nexusPassword
username ossrhUsername
password ossrhPassword
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions docs/Release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ There are 5 keys for successful publishing and they can be provided via `local.p

| Key | local.properties property name | environment variable name |
| ------------------- | :----------------------------: | :-----------------------: |
| Nexus User Name | `nexusUsername` | `NEXUS_USERNAME` |
| Nexus Password | `nexusPassword` | `NEXUS_PASSWORD` |
| Ossrh Username | `ossrhUsername` | `OSSRH_USERNAME` |
| Ossrh password | `ossrhPassword` | `OSSRH_PASSWORD` |
| GPG Key ID | `signingKeyId` | `SIGNING_KEY_ID` |
| GPG Private Key | `signingKey` | `SIGNING_KEY` |
| GPG Password Phrase | `signingPassword` | `SIGNING_PASSWORD` |

> [!NOTE]
> If GPG keys are outdated, you need to generate them using GnuGP. Don't forget to publish the public key to repository (e.g. keys.ubuntu.com) so the Sonatype can verify the public key.

## Plugins

The release process is using the Gradle plugin [maven-publish](https://docs.gradle.org/current/userguide/publishing_maven.html) for creating the publication from the source code and the metadata and sends it to the [Nexus Repository Manager](https://s01.oss.sonatype.org/). The second Gradle plugin, [signing](https://docs.gradle.org/current/userguide/signing_plugin.html#signing_plugin), is responsible for signing the artifacts produced by the maven-publish plugin.
Expand Down
4 changes: 2 additions & 2 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<trusted-artifacts>
<trust file=".*-javadoc[.]jar" regex="true"/>
<trust file=".*-sources[.]jar" regex="true"/>
<trust group="ai.kontent" name="delivery-sdk" version="[0-9]+.[0-9]+.[0-9]+-SNAPSHOT" regex="true"/>
<trust group="ai.kontent" name="delivery-sdk-generators" version="[0-9]+.[0-9]+.[0-9]+-SNAPSHOT" regex="true"/>
<trust group="ai.kontent" name="delivery-sdk" version="[0-9]+.[0-9]+.[0-9]+(-SNAPSHOT)?" regex="true"/>
<trust group="ai.kontent" name="delivery-sdk-generators" version="[0-9]+.[0-9]+.[0-9]+(-SNAPSHOT)?" regex="true"/>
<trust group="com.android.tools.build"/>
</trusted-artifacts>
</configuration>
Expand Down
9 changes: 5 additions & 4 deletions local.properties.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
sdk.dir=

# https://docs.gradle.org/6.3/userguide/signing_plugin.html#sec:in-memory-keys
signingKeyId=A5992A24
signingKeyId=11D844AB
signingPassword=
# Starts with -----BEGIN PGP PRIVATE KEY BLOCK-----\n\n... - no apostrophes wrapping: ""
# Starts with -----BEGIN PGP PRIVATE KEY BLOCK-----\n\n... - no apostrophes wrapping: "".
# Be aware of using \n instead of every new line!
signingKey=

nexusUsername=
nexusPassword=
ossrhUsername=
ossrhPassword=
Loading