diff --git a/.ado/gitTagRelease.js b/.ado/gitTagRelease.js index 70fe26d187..75c96ccc08 100644 --- a/.ado/gitTagRelease.js +++ b/.ado/gitTagRelease.js @@ -28,7 +28,7 @@ function doPublish() { exec(`git config --global user.email "53619745+rnbot@users.noreply.github.com"`); exec(`git config --global user.name "React-Native Bot"`); - exec(`git add ${pkgJsonPath}`); + exec(`git add .`); exec(`git commit -m "Applying package update to ${releaseVersion} ***NO_CI***"`); exec(`git tag v${releaseVersion}`); exec(`git push origin HEAD:${tempPublishBranch} --follow-tags --verbose`); diff --git a/.ado/npmOfficePack.js b/.ado/npmOfficePack.js index 7f383ce3c7..b1d549ed9b 100644 --- a/.ado/npmOfficePack.js +++ b/.ado/npmOfficePack.js @@ -28,7 +28,7 @@ function doPublish(fakeMode) { if (!onlyTagSource) { // -------- Generating Android Artifacts with JavaDoc const depsEnvPrefix = "REACT_NATIVE_BOOST_PATH=" + path.join(process.env.BUILD_SOURCESDIRECTORY, "build_deps"); - const gradleCommand = path.join(process.env.BUILD_SOURCESDIRECTORY, "gradlew") + " installArchives"; + const gradleCommand = path.join(process.env.BUILD_SOURCESDIRECTORY, "gradlew") + " installArchives -Pparam=\"excludeLibs\""; exec( depsEnvPrefix + " " + gradleCommand ); // undo uncommenting javadoc setting diff --git a/.ado/publish.yml b/.ado/publish.yml index 10f50e05a7..4a5cce7542 100644 --- a/.ado/publish.yml +++ b/.ado/publish.yml @@ -16,11 +16,14 @@ trigger: pr: none +variables: + - template: variables/mac.yml + jobs: - job: RNGithubNpmJSPublish displayName: React-Native GitHub Publish to npmjs.org pool: - vmImage: vs2017-win2016 + vmImage: $(VmImage) timeoutInMinutes: 90 # how long to run the job before automatically cancelling cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them steps: @@ -47,6 +50,8 @@ jobs: displayName: Set dist-tag to v0.x-stable condition: and(ne(variables['Build.SourceBranchName'], 'master'), ne(variables['Build.SourceBranchName'], variables.latestStableBranch)) + - template: templates/apple-node-setup.yml + - task: CmdLine@2 displayName: yarn install inputs: @@ -56,13 +61,21 @@ jobs: displayName: Bump stable package version inputs: script: node .ado/bumpFileVersions.js - condition: ne(variables['Build.SourceBranchName'], 'master') + condition: and(succeeded(), ne(variables['Build.SourceBranchName'], 'master')) + + - task: CmdLine@2 + displayName: pod update React-TurboModuleCxx-RNW + inputs: + script: | + cd packages/rn-tester + pod update React-TurboModuleCxx-RNW + condition: and(succeeded(), ne(variables['Build.SourceBranchName'], 'master')) - task: CmdLine@2 displayName: Bump canary package version inputs: script: node scripts/bump-oss-version.js --nightly - condition: eq(variables['Build.SourceBranchName'], 'master') + condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master')) # Publish will fail if package.json is marked as private - task: CmdLine@2 @@ -88,7 +101,7 @@ jobs: BUILD_SOURCEBRANCH: $(Build.SourceBranch) SYSTEM_ACCESSTOKEN: $(System.AccessToken) githubApiToken: $(githubApiToken) - condition: ne(variables['Build.SourceBranchName'], 'master') + condition: and(succeeded(), ne(variables['Build.SourceBranchName'], 'master')) - job: RNMacOSInitNpmJSPublish @@ -149,6 +162,12 @@ jobs: inputs: script: node .ado/bumpOfficeFileVersions.js + # Publish will fail if package.json is marked as private + - task: CmdLine@2 + displayName: Remove workspace config from package.json + inputs: + script: node .ado/removeWorkspaceConfig.js + - task: CmdLine@2 displayName: gradlew installArchives inputs: diff --git a/.ado/versionUtils.js b/.ado/versionUtils.js index 6f8f85fc08..21651c44bd 100644 --- a/.ado/versionUtils.js +++ b/.ado/versionUtils.js @@ -2,6 +2,7 @@ const fs = require("fs"); const path = require("path"); const semver = require('semver'); +const {execSync} = require('child_process'); const pkgJsonPath = path.resolve(__dirname, "../package.json"); let publishBranchName = ''; @@ -41,9 +42,9 @@ function updateVersionsInFiles(patchVersionPrefix) { } pkgJson.version = releaseVersion; - fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2)); - console.log(`Updating package.json to version ${releaseVersion}`); - + console.log(`Bumping files to version ${releaseVersion}`); + execSync(`node ./scripts/bump-oss-version.js --rnmpublish ${releaseVersion}`, {stdio: 'inherit', env: process.env}); + return {releaseVersion, branchVersionSuffix}; } diff --git a/scripts/bump-oss-version.js b/scripts/bump-oss-version.js index a940e4fc9a..9107380bde 100755 --- a/scripts/bump-oss-version.js +++ b/scripts/bump-oss-version.js @@ -29,6 +29,11 @@ let argv = yargs type: 'boolean', default: false, }) + .option('p', { // [MacOS: Used during RNM's publish pipelines + alias: 'rnmpublish', + type: 'boolean', + default: false, + }) .option('n', { alias: 'nightly', type: 'boolean', @@ -37,6 +42,7 @@ let argv = yargs const nightlyBuild = argv.nightly; const ci = argv.ci; +const rnmpublish = argv.rnmpublish; let version, branch; if (nightlyBuild) { @@ -45,10 +51,15 @@ if (nightlyBuild) { }).stdout.trim(); version = `0.0.0-${currentCommit.slice(0, 9)}`; } else { - // Check we are in release branch, e.g. 0.33-stable - branch = exec('git symbolic-ref --short HEAD', { - silent: true, - }).stdout.trim(); + if (!ci && process.env.BUILD_SOURCEBRANCH) { + console.log(`BUILD_SOURCEBRANCH: ${process.env.BUILD_SOURCEBRANCH}`) + branch = process.env.BUILD_SOURCEBRANCH.match(/refs\/heads\/(.*)/)[1]; + console.log(`Identified branch: ${branch}`) + } else { + branch = exec('git symbolic-ref --short HEAD', { + silent: true, + }).stdout.trim(); + } if (!ci && branch.indexOf('-stable') === -1) { echo('You must be in 0.XX-stable branch to bump a version'); @@ -133,8 +144,10 @@ fs.writeFileSync( let packageJson = JSON.parse(cat('package.json')); packageJson.version = version; -delete packageJson.workspaces; -delete packageJson.private; +if (!rnmpublish) { + delete packageJson.workspaces; + delete packageJson.private; +} fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2), 'utf-8'); // Change ReactAndroid/gradle.properties @@ -161,7 +174,7 @@ let numberOfChangedLinesWithNewVersion = exec( // Release builds should commit the version bumps, and create tags. // Nightly builds do not need to do that. -if (!nightlyBuild) { +if (!nightlyBuild && !rnmpublish) { if (+numberOfChangedLinesWithNewVersion !== 3) { echo( 'Failed to update all the files. package.json and gradle.properties must have versions in them',