Skip to content

Commit

Permalink
Use $buildNumber$ token for NuGet (#198)
Browse files Browse the repository at this point in the history
* Use Nuget token for versions

* Use NuGet v4.6.4+

* Add buildProps during Android PR
  • Loading branch information
statm authored Dec 5, 2019
1 parent 99e819f commit 39ce8a7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .ado/android-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
- task: UseNode@1
inputs:
version: '10.x'

# Install NuGet v4.6.4+
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=4.6.4'

- task: CmdLine@2
displayName: npm install
Expand Down Expand Up @@ -112,6 +117,7 @@ jobs:
command: pack
packagesToPack: 'ReactAndroid/ReactAndroid.nuspec'
packDestination: '$(System.DefaultWorkingDirectory)'
buildProperties: buildNumber=$(buildNumber);commitId=$(Build.SourceVersion)

- task: Gradle@1
displayName: gradlew clean
Expand Down
6 changes: 6 additions & 0 deletions .ado/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ jobs:
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch

# Install NuGet v4.6.4+
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=4.6.4'

- task: CmdLine@2
displayName: npm install
inputs:
Expand Down Expand Up @@ -110,6 +115,7 @@ jobs:
command: pack
packagesToPack: 'ReactAndroid/ReactAndroid.nuspec'
packDestination: '$(Build.StagingDirectory)\final'
buildProperties: buildNumber=$(buildNumber);commitId=$(Build.SourceVersion)

- task: CmdLine@2
displayName: Do Publish
Expand Down
4 changes: 2 additions & 2 deletions .ado/templates/prep-android-nuget.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
steps:
- task: PowerShell@2
displayName: Extract version from package.json, and put it in nuspec
displayName: Extract version from package.json, and put it in `buildNumber` variable
inputs:
targetType: inline # filePath | inline
script: |
$lines = Get-Content package.json | Where {$_ -match '^\s*"version":.*'}
$npmVersion = $lines.Trim().Split()[1].Trim('",');
(Get-Content ReactAndroid/ReactAndroid.nuspec).replace('__BuildBuildNumber__', $npmVersion) | Set-Content ReactAndroid/ReactAndroid.nuspec
echo "##vso[task.setvariable variable=buildNumber]$npmVersion"
# Pretty yucky - but we dont want devmain to have to update versions _all_ over the place
- task: PowerShell@2
Expand Down
3 changes: 2 additions & 1 deletion ReactAndroid/ReactAndroid.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>OfficeReact.Android</id>
<version>__BuildBuildNumber__</version>
<version>$buildNumber$</version>
<description>Contains Android Implementation of React-Native</description>
<authors>Microsoft</authors>
<projectUrl>https://github.com/microsoft/react-native</projectUrl>
<repository type="git" url="https://github.com/microsoft/react-native.git" commit="$commitId$" />
<requireLicenseAcceptance>false</requireLicenseAcceptance>
</metadata>

Expand Down

0 comments on commit 39ce8a7

Please sign in to comment.