Skip to content

Commit

Permalink
Removed publishing as GitHub package
Browse files Browse the repository at this point in the history
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
  • Loading branch information
jpkrohling committed Nov 27, 2020
1 parent df5d9dc commit 6a0e660
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish package to the Maven Central Repository and GitHub Packages
name: Release
on:
release:
types: [created]
Expand All @@ -16,10 +16,9 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Publish to the Maven Central Repository
- name: Publish to Sonatype OSS Nexus
run: ./gradlew publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_TOKEN }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_ARMORED_KEY }}
Expand Down
17 changes: 10 additions & 7 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ This project uses the regular Gradle mechanics to publish artifacts. The release
1. Tag the release: `git tag v0.1.1`
1. Push the tag to the main repository: `git push [email protected]:opentracing-contrib/java-interceptors.git v0.1.1`

Once this is done, GitHub will trigger a release, uploading it to Maven Central and GitHub Packages for this repository.
Once this is done, GitHub will trigger a release, uploading it to Sonatype OSS Nexus instance (Maven Central). The automated release will not attempt to close nor release the staging repository created at Sonatype's OSS Nexus instance. Once a release is successful, make sure to close and release the staging repository.

## Manual

To do a manual release, you'll first need a few environment variables:

* `GITHUB_ACTOR`, set to your GitHub username, required to publish as a GitHub package
* `GITHUB_TOKEN` (with `write:packages` permission only), required to publish as a GitHub package
* `ORG_GRADLE_PROJECT_sonatypeUsername`, required to publish to Maven Central
* `ORG_GRADLE_PROJECT_sonatypePassword`, required to publish to Maven Central
* `ORG_GRADLE_PROJECT_signingKey`, required to publish to Maven Central
* `ORG_GRADLE_PROJECT_signingPassword`, required to publish to Maven Central
* `ORG_GRADLE_PROJECT_sonatypeUsername`
* `ORG_GRADLE_PROJECT_sonatypePassword`
* `ORG_GRADLE_PROJECT_signingKey`
* `ORG_GRADLE_PROJECT_signingPassword`

The signing key can be set as follows. You'll need the key's password (passphrase).

Expand All @@ -33,3 +31,8 @@ git checkout v0.1.1
./gradlew publish
```

Similar to the automated release, this will not close nor release the staging repository. You'll need to do it manually.

## Sonatype OSS Nexus

Publishing to Sonatype OSS Nexus via Gradle often fails, as Nexus will create a staging repository when the first file is uploaded. As this might take a while, Gradle might think it timed out and retry the request, triggering the creation of another staging repository. Once that happens, you'll end up with two repositories: one probably containing only one file, and another containing all files (including the one from the first repository). In that case, drop one of the repositories and re-run the `publish` Gradle command, just to be safe. This time, the existing repository should be used. For the automated release, it's safe to re-run the release workflow once only one of the staging repositories is available.
8 changes: 0 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ publishing {
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/opentracing-contrib/java-interceptors"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
maven {
name = "OSSRH"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
Expand Down

0 comments on commit 6a0e660

Please sign in to comment.