Use $buildNumber$ token for NuGet (#199)

* Add 0.59-stable branch to PR build trigger (#202)

* Use Node 10

* Use Nuget token for versions

* Use buildNumber token for Apple

* Use NuGet v4.6.4+

* Add buildProps during Android PR
This commit is contained in:
Brian Zhao 2019-12-06 14:42:14 -08:00 коммит произвёл GitHub
Родитель fbd67d280a
Коммит e7a25798a7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 17 добавлений и 4 удалений

Просмотреть файл

@ -26,6 +26,11 @@ jobs:
inputs:
version: '10.x'
# Install NuGet v4.6.4+
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=4.6.4'
- task: CmdLine@2
displayName: npm install
inputs:
@ -113,6 +118,7 @@ jobs:
command: pack
packagesToPack: 'ReactAndroid/ReactAndroid.nuspec'
packDestination: '$(System.DefaultWorkingDirectory)'
buildProperties: buildNumber=$(buildNumber);commitId=$(Build.SourceVersion)
- task: Gradle@1
displayName: gradlew clean

Просмотреть файл

@ -29,6 +29,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:
@ -111,6 +116,7 @@ jobs:
command: pack
packagesToPack: 'ReactAndroid/ReactAndroid.nuspec'
packDestination: '$(Build.StagingDirectory)\final'
buildProperties: buildNumber=$(buildNumber);commitId=$(Build.SourceVersion)
- task: CmdLine@2
displayName: Do Publish

Просмотреть файл

@ -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

Просмотреть файл

@ -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>

Просмотреть файл

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>OfficeReact.Apple</id>
<version>__BuildBuildNumber__</version>
<version>$buildNumber$</version>
<description>Contains Mac and iOS Implementations of React-Native</description>
<authors>Microsoft</authors>
<projectUrl>https://github.com/microsoft/react-native</projectUrl>