Skip to content

Commit

Permalink
Gate the Maven Central publishing to 0.x version. (#35109)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #35109

This is just a safety check to make sure we don't accidentally
publish a 1.x or a 1000.x version on Maven Central by mistake.

Changelog:
[Internal] [Changed] - Gate the Maven Central publishing to 0.x version.

Reviewed By: mdvacca

Differential Revision: D40767782

fbshipit-source-id: 58f2906c3b01bfd0fd388a300ba303b289633d4e
  • Loading branch information
cortinico authored and facebook-github-bot committed Oct 28, 2022
1 parent 6a43faf commit 76f7084
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion scripts/publish-npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const isLatest = exitIfNotOnGit(

// We first publish on Maven Central all the necessary artifacts.
// NPM publishing is done just after.
publishAndroidArtifactsToMaven(nightlyBuild);
publishAndroidArtifactsToMaven(releaseVersion, nightlyBuild);

const releaseBranch = `${major}.${minor}-stable`;

Expand Down
6 changes: 4 additions & 2 deletions scripts/release-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function generateAndroidArtifacts(releaseVersion, tmpPublishingFolder) {
});
}

function publishAndroidArtifactsToMaven(isNightly) {
function publishAndroidArtifactsToMaven(releaseVersion, isNightly) {
// -------- Publish every artifact to Maven Central
// The GPG key is base64 encoded on CircleCI
let buff = Buffer.from(env.ORG_GRADLE_PROJECT_SIGNING_KEY_ENCODED, 'base64');
Expand All @@ -79,7 +79,9 @@ function publishAndroidArtifactsToMaven(isNightly) {
exit(1);
}

if (!isNightly) {
// We want to gate ourselves against accidentally publishing a 1.x or a 1000.x on
// maven central which will break the semver for our artifacts.
if (!isNightly && releaseVersion.startsWith('0.')) {
// -------- For stable releases, we also need to close and release the staging repository.
if (exec('./gradlew closeAndReleaseSonatypeStagingRepository').code) {
echo(
Expand Down

0 comments on commit 76f7084

Please sign in to comment.