diff --git a/.ado/bumpFileVersions.js b/.ado/bumpFileVersions.js deleted file mode 100644 index 717d48eecf6..00000000000 --- a/.ado/bumpFileVersions.js +++ /dev/null @@ -1,8 +0,0 @@ -// @ts-check -// Just bump the local version numbers in the files... - -const { - updateVersionsInFiles, -} = require("./versionUtils"); - -updateVersionsInFiles(); diff --git a/.ado/publish.yml b/.ado/publish.yml index 5e891d30f42..3fcf1c341bc 100644 --- a/.ado/publish.yml +++ b/.ado/publish.yml @@ -37,17 +37,11 @@ jobs: - task: CmdLine@2 displayName: Update package version + name: updateVersionTask inputs: script: node ../.ado/updateVersion.js workingDirectory: vnext - # since the above task will update the package.json, we want to ensure that we use the correct version for the nuget - - task: PublishBuildArtifacts@1 - displayName: 'Publish updated package.json for nuget' - inputs: - PathtoPublish: 'vnext\package.json' - ArtifactName: 'UpdatedPackageJson' - - task: Npm@1 displayName: npm public publish (vnext) inputs: @@ -61,6 +55,8 @@ jobs: - job: RnwNativeBuild displayName: React-Native-Windows Native Build dependsOn: RnwNpmPublish + variables: + publishCommitId: $[ dependencies.RnwNpmPublish.outputs['updateVersionTask.publishCommitId'] ] strategy: matrix: X64Debug: @@ -90,13 +86,11 @@ jobs: steps: - # The RnwNpmPublish task does this too before publishing the npm package, - # but when each slice checks out code, its not going to have those changes + # Sync to point where the version numbers have been updated - task: CmdLine@2 - displayName: Update version numbers to align with publishing version inputs: - script: node ../.ado/bumpFileVersions.js - workingDirectory: vnext + script: git checkout $(publishCommitId) + - template: templates/npm-install-and-build.yml @@ -115,20 +109,28 @@ jobs: - job: RNWNuget - dependsOn: RnwNativeBuild + dependsOn: + - RnwNpmPublish + - RnwNativeBuild displayName: React-Native-Windows Build and Publish Nuget pool: name: OE Standard Pool + variables: + publishCommitId: $[ dependencies.RnwNpmPublish.outputs['updateVersionTask.publishCommitId'] ] + npmVersion: $[ dependencies.RnwNpmPublish.outputs['updateVersionTask.npmVersion'] ] + steps: - checkout: none #skip checking out the default repository resource - - task: DownloadBuildArtifacts@0 - displayName: 'Download source Artifact' + # The commit tag in the nuspec requires that we use at least nuget 4.6 + - task: NuGetToolInstaller@0 inputs: - artifactName: UpdatedPackageJson - downloadPath: $(System.DefaultWorkingDirectory) + versionSpec: '>=4.6.0' - template: templates/prep-and-pack-nuget.yml + parameters: + publishCommitId: $(publishCommitId) + npmVersion: $(npmVersion) - task: NuGetCommand@2 displayName: 'NuGet push' diff --git a/.ado/templates/prep-and-pack-nuget.yml b/.ado/templates/prep-and-pack-nuget.yml index b7ce2fcb293..5a0ce0b1da3 100644 --- a/.ado/templates/prep-and-pack-nuget.yml +++ b/.ado/templates/prep-and-pack-nuget.yml @@ -1,3 +1,6 @@ +parameters: + publishCommitId: '0' + npmVersion: '0.0.1-pr' steps: - task: DownloadBuildArtifacts@0 @@ -50,23 +53,10 @@ steps: robocopy $(System.DefaultWorkingDirectory)\ReactWindows-debug-arm $(System.DefaultWorkingDirectory)\NugetRoot\target\arm\debug /E /MOVE /NP robocopy $(System.DefaultWorkingDirectory)\ReactWindows-ship-arm $(System.DefaultWorkingDirectory)\NugetRoot\target\arm\ship /E /MOVE /NP - - task: PowerShell@2 - displayName: Extract version from package.json, and put it in nuspec - inputs: - targetType: inline # filePath | inline - script: | - if (Test-Path $env:SYSTEM_DEFAULTWORKINGDIRECTORY/UpdatedPackageJson/package.json) { - $lines = Get-Content $env:SYSTEM_DEFAULTWORKINGDIRECTORY/UpdatedPackageJson/package.json | Where {$_ -match '^\s*"version":.*'} - $npmVersion = $lines.Trim().Split()[1].Trim('",'); - } else { - $npmVersion = "0.0.1-pr" - } - (Get-Content $env:SYSTEM_DEFAULTWORKINGDIRECTORY/NugetRoot/ReactWin32.nuspec).replace('__BuildBuildNumber__', $npmVersion) | Set-Content $env:SYSTEM_DEFAULTWORKINGDIRECTORY/NugetRoot/ReactWin32.nuspec - (Get-Content $env:SYSTEM_DEFAULTWORKINGDIRECTORY/NugetRoot/ReactUwp.nuspec).replace('__BuildBuildNumber__', $npmVersion) | Set-Content $env:SYSTEM_DEFAULTWORKINGDIRECTORY/NugetRoot/ReactUwp.nuspec - - task: NuGetCommand@2 displayName: 'NuGet pack' inputs: command: pack packagesToPack: '$(System.DefaultWorkingDirectory)/NugetRoot/React*.nuspec' - packDestination: '$(System.DefaultWorkingDirectory)/NugetRoot/' \ No newline at end of file + packDestination: '$(System.DefaultWorkingDirectory)/NugetRoot/' + buildProperties: CommitId=${{parameters.publishCommitId}};npmVersion=${{parameters.npmVersion}} \ No newline at end of file diff --git a/.ado/templates/vs-build.yml b/.ado/templates/vs-build.yml index 273025ef7b6..2501c60cf67 100644 --- a/.ado/templates/vs-build.yml +++ b/.ado/templates/vs-build.yml @@ -14,7 +14,7 @@ steps: feedsToUse: config #vstsFeed: # Required when feedsToUse == Select #includeNuGetOrg: true # Required when feedsToUse == Select - nugetConfigPath: vnext/NuGet.config + nugetConfigPath: vnext/NuGet.config #externalFeedCredentials: # Optional #noCache: false #disableParallelProcessing: false diff --git a/.ado/updateVersion.js b/.ado/updateVersion.js index 970c278be2c..859d84f8ba5 100644 --- a/.ado/updateVersion.js +++ b/.ado/updateVersion.js @@ -65,6 +65,11 @@ function updateVersion() { exec(`git push origin HEAD:${tempPublishBranch} --follow-tags --verbose`); exec(`git push origin tag ${tagName}`); + // Record the updated npmVersion and commitId so that later build tasks can use it (to record in the nuget for instance) + const publishCommitId = execSync(`git rev-list -n 1 ${tagName}`); + console.log(`##vso[task.setvariable variable=publishCommitId;isOutput=true]${publishCommitId}`); + console.log(`##vso[task.setvariable variable=npmVersion;isOutput=true]${releaseVersion}`); + exec(`git checkout ${publishBranchName}`); exec(`git pull origin ${publishBranchName}`); exec(`git merge ${tempPublishBranch} --no-edit`); diff --git a/.ado/windows-vs-pr.yml b/.ado/windows-vs-pr.yml index 7de3d672fb7..8227039782a 100644 --- a/.ado/windows-vs-pr.yml +++ b/.ado/windows-vs-pr.yml @@ -380,4 +380,9 @@ jobs: steps: - checkout: none #skip checking out the default repository resource + # The commit tag in the nuspec requires that we use at least nuget 4.6 + - task: NuGetToolInstaller@0 + inputs: + versionSpec: '>=4.6.0' + - template: templates/prep-and-pack-nuget.yml diff --git a/vnext/ReactUwp.nuspec b/vnext/ReactUwp.nuspec index e3aa48465e5..58c8eb21a22 100644 --- a/vnext/ReactUwp.nuspec +++ b/vnext/ReactUwp.nuspec @@ -2,11 +2,14 @@ OfficeReact.Uwp - __BuildBuildNumber__ + $npmVersion$ Contains Windows Implementation of React-Native Microsoft https://office.visualstudio.com/ISS/_git/sdx-platform false + diff --git a/vnext/ReactWin32.nuspec b/vnext/ReactWin32.nuspec index 30acf1d5007..7e3a91ca12e 100644 --- a/vnext/ReactWin32.nuspec +++ b/vnext/ReactWin32.nuspec @@ -2,11 +2,14 @@ OfficeReact.Win32 - __BuildBuildNumber__ + $npmVersion$ Contains Windows Implementation of React-Native Microsoft https://office.visualstudio.com/ISS/_git/sdx-platform false + diff --git a/vnext/package.json b/vnext/package.json index 0686d256871..1e304ae7a59 100644 --- a/vnext/package.json +++ b/vnext/package.json @@ -13,7 +13,7 @@ "preinstall": "node Scripts/preInstall.js", "postinstall": "node Scripts/postInstall.js", "build": "just-scripts build", - "clean": "node Scripts/just.js clean", + "clean": "just-scripts clean", "start": "node Scripts/cli.js start", "watch": "node node_modules/@office-iss/sdx-build-tools/watch.js" },