Skip to content

Commit

Permalink
Change gradle publish plugin (#732)
Browse files Browse the repository at this point in the history
* Remove repositories configuration for old plugin

* Change plugin and version

* Modify gradle command in cd.yml

* Replace old nexus-staging.gradle

* Modify build.gradle

* Use tag to release artifact

* Fix gradle task in cd.yml

* Revert unnecessary change in cd.yml

* Revert "Revert unnecessary change in cd.yml"

This reverts commit 367c278.

* Revert "Fix gradle task in cd.yml"

This reverts commit 5b861c3.

* Fix gradle task spelling

* Update BUILD.md

* Modify cd.yml

* Modify RELEASE_NOTES.md

* Modify RELEASE_NOTES.md
  • Loading branch information
leungkinghin-ct authored May 18, 2021
1 parent 26c4403 commit a83c91d
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 30 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,14 @@ jobs:
run: echo Build is tagged. Uploading artifact ${{ steps.vars.outputs.tag }} to maven central.
- name: Publish GitHub Pages
run: ./gradlew --info -Dbuild.version="${{ steps.vars.outputs.tag }}" mkdocsPublish
- name: deploy to sonatype
run: ./gradlew setLibraryVersion -Dbuild.version="${{ steps.vars.outputs.tag }}" publish
- name: deploy to sonatype and publish to maven central
run: ./gradlew setLibraryVersion -Dbuild.version="${{ steps.vars.outputs.tag }}" publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
GITHUB_TAG: ${{ steps.vars.outputs.tag }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
PGP_KEY: ${{ secrets.PGP_KEY }}
PGP_PASSWORD: ${{ secrets.PGP_PASSWORD }}
- name: release to maven Central
run: ./gradlew closeAndReleaseRepository
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Slack notification
if: success() # only when previous step succeeds
env:
Expand All @@ -77,4 +72,4 @@ jobs:
SLACK_CHANNEL: java-sync
uses: Ilshidur/action-slack@master
with:
args: 'Version: <https://github.com/commercetools/commercetools-sync-java/releases/tag/${{ steps.vars.outputs.tag }}|${{ steps.vars.outputs.tag }}> of the library is published to the <https://oss.sonatype.org/|nexus repository manager>, check <https://github.com/commercetools/commercetools-sync-java/blob/master/docs/BUILD.md#step-3-publish-to-maven-central|here> for the next steps.'
args: 'Version: <https://github.com/commercetools/commercetools-sync-java/releases/tag/${{ steps.vars.outputs.tag }}|${{ steps.vars.outputs.tag }}> of the library has been published to the <https://repo1.maven.org/maven2/com/commercetools/commercetools-sync-java/|Maven Central>.'
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id 'ru.vyarus.mkdocs' version '2.1.1'
id "com.github.spotbugs" version "4.7.1"
id 'com.diffplug.spotless' version '5.12.5'
id 'io.codearte.nexus-staging' version '0.30.0'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
}

ext{
Expand All @@ -19,6 +19,7 @@ ext{
caffeineVersion = '2.8.5'
nexusStagingPluginVersion = '0.22.0'
}

apply from: "$rootDir/gradle-scripts/repositories.gradle"
apply from: "$rootDir/gradle-scripts/plugins.gradle"
apply from: "$rootDir/gradle-scripts/extensions.gradle"
Expand All @@ -33,7 +34,7 @@ apply from: "$rootDir/gradle-scripts/pmd.gradle"
apply from: "$rootDir/gradle-scripts/jacoco.gradle"
apply from: "$rootDir/gradle-scripts/spotbugs.gradle"
apply from: "$rootDir/gradle-scripts/maven-publish.gradle"
apply from: "$rootDir/gradle-scripts/nexus-staging.gradle"
apply from: "$rootDir/gradle-scripts/nexus-publish.gradle"
apply from: "$rootDir/gradle-scripts/javadocs-publish.gradle"
apply from: "$rootDir/gradle-scripts/set-library-version.gradle"
apply from: "$rootDir/gradle-scripts/execution-order.gradle"
Expand Down
2 changes: 1 addition & 1 deletion docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ For example, define the link to the release notes pointing to a released version

> Additionally define important changes, breaking changes or important new features into the description.
The creation of a github release triggers a [github action](https://github.com/commercetools/commercetools-sync-java/actions?query=workflow%3ACD), which will deploy the library to [Maven Central](https://mvnrepository.com/artifact/com.commercetools/commercetools-sync-java).
The creation of a github release triggers a [github action](https://github.com/commercetools/commercetools-sync-java/actions?query=workflow%3ACD), which will deploy the library first to [Sonatype staging repo](https://oss.sonatype.org) and then to [Maven Central](https://mvnrepository.com/artifact/com.commercetools/commercetools-sync-java).

## Final Step
After the release build status is **success** ensure that the new version is publicly available at [Maven Central](https://repo1.maven.org/maven2/com/commercetools/commercetools-sync-java).
Expand Down
15 changes: 12 additions & 3 deletions docs/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,18 @@
- **Product Sync** - Special characters can be defined for ProductDraft key. [#269](https://github.com/commercetools/commercetools-project-sync/issues/269)
- **Product Sync** - After a fix from JVM-SDK(1.63.0), Added integration tests to make sure `PriceTiers` are synched successfully. [#271](https://github.com/commercetools/commercetools-project-sync/issues/271)

- 🛠️ **Dependency Updates** (1)
commercetools-jvm-sdk 1.62.0 -> [1.63.0](http://commercetools.github.io/commercetools-jvm-sdk/apidocs/io/sphere/sdk/meta/ReleaseNotes.html#v1_63_0)

- 🛠️ **Dependency Updates** (7)
- `commercetools-jvm-sdk 1.62.0` -> [1.63.0](http://commercetools.github.io/commercetools-jvm-sdk/apidocs/io/sphere/sdk/meta/ReleaseNotes.html#v1_63_0)
- `io.codearte.nexus-staging 0.30.0` -> `io.github.gradle-nexus.publish-plugin 1.11.0` (Adapt new gradle plugin for artifact publishing)
- `com.github.spotbugs 4.7.0` -> `4.7.1`
- `com.diffplug.spotless 5.12.1` -> `5.12.5`
- `org.mockito:mockito-junit-jupiter 3.9.0` -> `3.10.0`
- `org.junit.jupiter 5.7.0` -> `5.7.2`
- `netty-codec-http 4.1.63.Final` -> `4.1.64.Final`

**Build Tools** (1)
- Change build script and cd.yml for new gradle publish plugin.

### 5.1.0 - Apr 20, 2021
[Commits](https://github.com/commercetools/commercetools-sync-java/compare/5.0.0...5.1.0) |
[Javadoc](https://commercetools.github.io/commercetools-sync-java/v/5.1.0/) |
Expand Down
12 changes: 0 additions & 12 deletions gradle-scripts/maven-publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ publishing {
}
}
}
repositories {
maven {
name = "maven"
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = rootProject.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}

signing {
Expand Down
8 changes: 8 additions & 0 deletions gradle-scripts/nexus-publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
nexusPublishing {
repositories {
sonatype {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
4 changes: 0 additions & 4 deletions gradle-scripts/nexus-staging.gradle

This file was deleted.

0 comments on commit a83c91d

Please sign in to comment.