diff --git a/.circleci/config.yml b/.circleci/config.yml index 150bf233f541..d54413cdf2d5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1378,12 +1378,14 @@ jobs: - checkout - *attach_hermes_workspace - run: - name: Copy HermesC binaries + name: Copy Hermes binaries command: | mkdir -p ./sdks/hermesc ./sdks/hermesc/osx-bin ./sdks/hermesc/win64-bin ./sdks/hermesc/linux64-bin cp -r $HERMES_WS_DIR/osx-bin/* ./sdks/hermesc/osx-bin/. cp -r $HERMES_WS_DIR/win64-bin/* ./sdks/hermesc/win64-bin/. cp -r $HERMES_WS_DIR/linux64-bin/* ./sdks/hermesc/linux64-bin/. + mkdir -p ./ReactAndroid/external-artifacts/artifacts/ + cp $HERMES_WS_DIR/hermes-runtime-darwin/hermes-runtime-darwin-debug-*.tar.gz ./ReactAndroid/external-artifacts/artifacts/hermes-ios.tar.gz - run_yarn - download_gradle_dependencies diff --git a/scripts/publish-npm.js b/scripts/publish-npm.js index e57321dea70d..5de46b96e165 100755 --- a/scripts/publish-npm.js +++ b/scripts/publish-npm.js @@ -40,6 +40,7 @@ const { } = require('./scm-utils'); const { generateAndroidArtifacts, + publishAndroidArtifactsToMaven, saveFilesToRestore, } = require('./release-utils'); const fs = require('fs'); @@ -196,6 +197,10 @@ const isLatest = exitIfNotOnGit( 'Not in git. We do not want to publish anything', ); +// We first publish on Maven Central all the necessary artifacts. +// NPM publishing is done just after. +publishAndroidArtifactsToMaven(nightlyBuild); + const releaseBranch = `${major}.${minor}-stable`; // Set the right tag for nightly and prerelease builds diff --git a/scripts/release-utils.js b/scripts/release-utils.js index e3ddd78dc949..879c05e1e809 100644 --- a/scripts/release-utils.js +++ b/scripts/release-utils.js @@ -76,7 +76,31 @@ function generateAndroidArtifacts(releaseVersion, tmpPublishingFolder) { }); } +function publishAndroidArtifactsToMaven(isNightly) { + // -------- Publish every artifact to Maven Central + if (exec('./gradlew publishAllToSonatype -PisNightly=' + isNightly).code) { + echo('Failed to publish artifacts to Sonatype (Maven Central)'); + exit(1); + } + + if (!isNightly) { + // -------- For stable releases, we also need to close and release the staging repository. + // TODO(ncor): Remove the --dry-run before RC0 + if ( + exec('./gradlew closeAndReleaseSonatypeStagingRepository --dry-run').code + ) { + echo( + 'Failed to close and release the staging repository on Sonatype (Maven Central)', + ); + exit(1); + } + } + + echo('Published artifacts to Maven Central'); +} + module.exports = { generateAndroidArtifacts, + publishAndroidArtifactsToMaven, saveFilesToRestore, };