Skip to content

Commit

Permalink
Modify publish task to publish nuget (#2497)
Browse files Browse the repository at this point in the history
* First stab at moving nuget creation to github

* Fix typo

* Update CopyToStaging

* Update staging bat

* More staging update

* Remove trailing \ from srcroot

* Typo in artifact name

* Rework where files were put

* remove react-native-windows prefix

* missed ship arm

* Replace original publish yaml

* Remove accidental whitespace
  • Loading branch information
acoates-ms authored May 17, 2019
1 parent 32b3dc1 commit f6e22af
Show file tree
Hide file tree
Showing 2 changed files with 360 additions and 3 deletions.
294 changes: 291 additions & 3 deletions .ado/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: $(Date:yyyyMMdd).$(Rev:.r)
name: 0.0.$(Date:yyMM.d)$(Rev:rrr)

trigger:
batch: true
Expand All @@ -17,8 +17,8 @@ trigger:
pr: none

jobs:
- job: RNWGithubPublish
displayName: React-Native-Windows GitHub Publish
- job: RnwNpmPublish
displayName: React-Native-Windows Npm Build Rev Publish
pool:
name: OE Standard Pool
demands: ['VisualStudio_15.0', 'OnPrem -equals False']
Expand Down Expand Up @@ -66,3 +66,291 @@ jobs:
customCommand: publish --access public --tag $(npmTag)
customEndpoint: 'React-Native-Windows NPM'
publishEndpoint: 'React-Native-Windows NPM'

- job: RnwNativeBuild
displayName: React-Native-Windows Native Build
dependsOn: RnwNpmPublish
strategy:
matrix:
X64Debug:
BuildConfiguration: Debug
BuildPlatform: x64
X86Debug:
BuildConfiguration: Debug
BuildPlatform: x86
ArmDebug:
BuildConfiguration: Debug
BuildPlatform: arm
X64Release:
BuildConfiguration: Release
BuildPlatform: x64
X86Release:
BuildConfiguration: Release
BuildPlatform: x86
ArmRelease:
BuildConfiguration: Release
BuildPlatform: arm
pool:
name: OE Standard Pool
demands:
- OnPrem -equals False
- msbuild
- Cmd

steps:

- task: NuGetCommand@2
displayName: NuGet restore - ReactWindows
inputs:
command: restore
restoreSolution: vnext/ReactWindows.sln
feedsToUse: config
#vstsFeed: # Required when feedsToUse == Select
#includeNuGetOrg: true # Required when feedsToUse == Select
nugetConfigPath: vnext/NuGet.config
#externalFeedCredentials: # Optional
#noCache: false
#disableParallelProcessing: false
restoreDirectory: packages/
verbosityRestore: Detailed # Options: quiet, normal, detailed
#packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' # Required when command == Push
#nuGetFeedType: 'internal' # Required when command == Push# Options: internal, external
#publishVstsFeed: # Required when command == Push && NuGetFeedType == Internal
#publishPackageMetadata: true # Optional
#allowPackageConflicts: # Optional
#publishFeedCredentials: # Required when command == Push && NuGetFeedType == External
#verbosityPush: 'Detailed' # Options: quiet, normal, detailed
#packagesToPack: '**/*.csproj' # Required when command == Pack
#configuration: '$(BuildConfiguration)' # Optional
#packDestination: '$(Build.ArtifactStagingDirectory)' # Optional
#versioningScheme: 'off' # Options: off, byPrereleaseNumber, byEnvVar, byBuildNumber
#includeReferencedProjects: false # Optional
#versionEnvVar: # Required when versioningScheme == ByEnvVar
#majorVersion: '1' # Required when versioningScheme == ByPrereleaseNumber
#minorVersion: '0' # Required when versioningScheme == ByPrereleaseNumber
#patchVersion: '0' # Required when versioningScheme == ByPrereleaseNumber
#packTimezone: 'utc' # Required when versioningScheme == ByPrereleaseNumber# Options: utc, local
#includeSymbols: false # Optional
#toolPackage: # Optional
#buildProperties: # Optional
#basePath: # Optional
#verbosityPack: 'Detailed' # Options: quiet, normal, detailed
#arguments: # Required when command == Custom

# The Hosted 2019 pool machines look like they already have this, so it wouldn't be needed..
- task: CmdLine@2
displayName: Ensure yarn
inputs:
script: npm install -g yarn
workingDirectory: vnext

- task: CmdLine@2
displayName: yarn install
inputs:
script: $(APPDATA)\npm\node_modules\yarn\bin\yarn.cmd install --frozen-lockfile
workingDirectory: vnext

- task: CmdLine@2
displayName: yarn build
inputs:
script: $(APPDATA)\npm\node_modules\yarn\bin\yarn.cmd build
workingDirectory: vnext

- task: MSBuild@1
displayName: MSBuild - ReactWindows
inputs:
solution: vnext/ReactWindows.sln
#msbuildLocationMethod: 'version' # Optional. Options: version, location
msbuildVersion: '15.0' # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0
msbuildArchitecture: 'x64' # Optional. Options: x86, x64
#msbuildLocation: # Optional
platform: $(BuildPlatform) # Optional
configuration: $(BuildConfiguration) # Optional
msbuildArguments: '/p:PreferredToolArchitecture=x64' # Optional
clean: true # Optional
#maximumCpuCount: false # Optional
#restoreNugetPackages: false # Optional
#logProjectEvents: false # Optional
#createLogFile: false # Optional
#logFileVerbosity: 'normal' # Optional. Options: quiet, minimal, normal, detailed, diagnostic

- task: BatchScript@1
displayName: 'Copy Nuget source files'
inputs:
filename: 'vnext\ReactWindows-CopyToStaging2.bat'
arguments: '$(build.artifactstagingdirectory)'
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Debug'), eq(variables['BuildPlatform'], 'x86'))

- task: PowerShell@2
displayName: 'Stage Sources'
inputs:
targetType: filePath
filePath: 'vnext\Scripts\Tfs\Layout-Headers.ps1'
arguments: '-TargetRoot $(Build.ArtifactStagingDirectory)'
enabled: false

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: debug arm'
inputs:
PathtoPublish: 'vnext\target\ARM\Debug'
ArtifactName: 'ReactWindows-debug-arm'
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Debug'), eq(variables['BuildPlatform'], 'arm'))

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: ship arm'
inputs:
PathtoPublish: 'vnext\target\ARM\Release'
ArtifactName: 'ReactWindows-ship-arm'
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Release'), eq(variables['BuildPlatform'], 'arm'))

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts debug x86'
inputs:
PathtoPublish: 'vnext\target\x86\Debug'
ArtifactName: 'ReactWindows-debug-x86'
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Debug'), eq(variables['BuildPlatform'], 'x86'))

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts ship x86'
inputs:
PathtoPublish: 'vnext\target\x86\Release'
ArtifactName: 'ReactWindows-ship-x86'
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Release'), eq(variables['BuildPlatform'], 'x86'))

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts debug x64'
inputs:
PathtoPublish: 'vnext\target\x64\debug'
ArtifactName: 'ReactWindows-debug-x64'
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Debug'), eq(variables['BuildPlatform'], 'x64'))

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts ship x64'
inputs:
PathtoPublish: 'vnext\target\x64\Release'
ArtifactName: 'ReactWindows-ship-x64'
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Release'), eq(variables['BuildPlatform'], 'x64'))

- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts - Nuget Source files'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'ReactWindows-source'
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Debug'), eq(variables['BuildPlatform'], 'x86'))

- task: PublishBuildArtifacts@1
displayName: 'Publish Build Artifacts'
inputs:
PathtoPublish: 'vnext\ReactWindows\target'
ArtifactName: ReactWindows
enabled: false

- task: PublishBuildArtifacts@1
displayName: 'Publish Sources'
inputs:
ArtifactName: ReactWindows
enabled: false
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Debug'), eq(variables['BuildPlatform'], 'x86'))

- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
SearchPattern: 'vnext/target/**/*.pdb'
SymbolServerType: TeamServices


- job: RNWNuget
dependsOn: RnwNativeBuild
displayName: React-Native-Windows Build and Publish Nuget
pool:
name: OE Standard Pool
steps:
- checkout: none #skip checking out the default repository resource
- task: DownloadBuildArtifacts@0
displayName: 'Download debug arm Artifact'
inputs:
artifactName: ReactWindows-debug-arm
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download ship arm Artifact'
inputs:
artifactName: ReactWindows-ship-arm
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download debug x86 Artifact'
inputs:
artifactName: ReactWindows-debug-x86
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download ship x86 Artifact'
inputs:
artifactName: ReactWindows-ship-x86
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download debug x64 Artifact'
inputs:
artifactName: ReactWindows-debug-x64
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download ship x64 Artifact'
inputs:
artifactName: ReactWindows-ship-x64
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadBuildArtifacts@0
displayName: 'Download source Artifact'
inputs:
artifactName: ReactWindows-source
downloadPath: $(System.DefaultWorkingDirectory)

- task: CopyFiles@2
displayName: 'Copy Win32 debug x64 files'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/ReactWindows-debug-x64'
TargetFolder: '$(System.DefaultWorkingDirectory)/NugetRoot/target/x64/Debug'
- task: CopyFiles@2
displayName: 'Copy Win32 debug x86 files'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/ReactWindows-debug-x86'
TargetFolder: '$(System.DefaultWorkingDirectory)/NugetRoot/target/x86/Debug'
- task: CopyFiles@2
displayName: 'Copy Win32 ship x64 files'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/ReactWindows-ship-x64'
TargetFolder: '$(System.DefaultWorkingDirectory)/NugetRoot/target/x64/ship'
- task: CopyFiles@2
displayName: 'Copy Win32 ship x86 files'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/ReactWindows-ship-x86'
TargetFolder: '$(System.DefaultWorkingDirectory)/NugetRoot/target/x86/ship'
- task: CopyFiles@2
displayName: 'Copy arm debug'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/ReactWindows-debug-arm'
TargetFolder: '$(System.DefaultWorkingDirectory)/NugetRoot/target/arm/debug'
- task: CopyFiles@2
displayName: 'Copy arm ship'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/ReactWindows-ship-arm'
TargetFolder: '$(System.DefaultWorkingDirectory)/NugetRoot/target/arm/ship'
- task: CopyFiles@2
displayName: 'Copy Nuget source files'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)/ReactWindows-source'
TargetFolder: '$(System.DefaultWorkingDirectory)/NugetRoot'
- task: colinsalmcorner.colinsalmcorner-buildtasks.replace-tokens-task.ReplaceTokens@1
displayName: 'Replace branch name in nuspec'
inputs:
filePattern: '$(System.DefaultWorkingDirectory)/NugetRoot/ReactWin32.nuspec'
secretTokens: 'BuildBuildNumber:$(Build.BuildNumber)'
- task: NuGetCommand@2
displayName: 'NuGet pack'
inputs:
command: pack
packagesToPack: '$(System.DefaultWorkingDirectory)/NugetRoot/ReactWin32.nuspec'
packDestination: '$(System.DefaultWorkingDirectory)/NugetRoot/'
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
packagesToPush: '$(System.DefaultWorkingDirectory)/NugetRoot/*.nupkg'
publishVstsFeed: '86ec7889-a365-4cd1-90df-6e18cc2ea59f'
69 changes: 69 additions & 0 deletions vnext/ReactWindows-CopyToStaging2.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@echo off
setlocal
goto :parse_args

:Usage
echo %~nx0 usage:
echo %~nx0 DestinationRoot
goto :eof

:parse_args
IF [%1]==[] GOTO :Usage

set DESTROOT=%~1
set SRCROOT=%~dp0
:: Remove trailing \ from srcroot
IF %SRCROOT:~-1%==\ SET SRCROOT=%SRCROOT:~0,-1%
set RNROOT=%~dp0node_modules\react-native

echo Source root: %SRCROOT%
echo Dest root: %DESTROOT%
echo React-Native root: %RNROOT%

set COPYCMD=xcopy /s /y /i

mkdir %DESTROOT% >nul 2>&1
mkdir %DESTROOT%\inc >nul 2>&1
mkdir %DESTROOT%\inc\cxxreact >nul 2>&1
mkdir %DESTROOT%\inc\jschelpers >nul 2>&1
mkdir %DESTROOT%\inc\jsi >nul 2>&1
mkdir %DESTROOT%\inc\yoga >nul 2>&1
mkdir %DESTROOT%\inc\ReactWin32 >nul 2>&1
mkdir %DESTROOT%\inc\ReactUWP >nul 2>&1

%COPYCMD% %RNROOT%\ReactCommon\cxxreact\cxxmodule.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\Instance.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\jsargumenthelpers-inl.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\jsargumenthelpers.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\JSBigString.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\JSCExecutor.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\JSCNativeModules.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\JSExecutor.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\MessageQueueThread.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\ModuleRegistry.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\NativeToJsBridge.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\NativeModule.h %DESTROOT%\inc\cxxreact
%COPYCMD% %RNROOT%\ReactCommon\cxxreact\PlatformBundleInfo.h %DESTROOT%\inc\cxxreact

%COPYCMD% %RNROOT%\ReactCommon\jsi\jsi.h %DESTROOT%\inc\jsi
%COPYCMD% %RNROOT%\ReactCommon\jsi\jsi-inl.h %DESTROOT%\inc\jsi
%COPYCMD% %RNROOT%\ReactCommon\jsi\ScriptStore.h %DESTROOT%\inc\jsi
%COPYCMD% %RNROOT%\ReactCommon\jsi\V8Runtime.h %DESTROOT%\inc\jsi
%COPYCMD% %SRCROOT%\Chakra\ChakraCoreDebugger.h %DESTROOT%\inc\jsi
%COPYCMD% %SRCROOT%\Chakra\ChakraJsiRuntimeArgs.h %DESTROOT%\inc\jsi
%COPYCMD% %SRCROOT%\Chakra\ChakraJsiRuntimeFactory.h %DESTROOT%\inc\jsi

%COPYCMD% %RNROOT%\ReactCommon\Yoga\Yoga\Yoga.h %DESTROOT%\inc\yoga
%COPYCMD% %RNROOT%\ReactCommon\Yoga\Yoga\YGMacros.h %DESTROOT%\inc\yoga
%COPYCMD% %RNROOT%\ReactCommon\Yoga\Yoga\YGNodeList.h %DESTROOT%\inc\yoga
%COPYCMD% %RNROOT%\ReactCommon\Yoga\Yoga\YGEnums.h %DESTROOT%\inc\yoga

%COPYCMD% %RNROOT%\Folly %DESTROOT%\inc\Folly
%COPYCMD% %SRCROOT%\stubs %DESTROOT%\inc\stubs
%COPYCMD% %SRCROOT%\Desktop\*.h %DESTROOT%\inc\ReactWin32
%COPYCMD% %SRCROOT%\ReactWindowsCore\*.h %DESTROOT%\inc\ReactWindowsCore
%COPYCMD% %SRCROOT%\ReactUWP\*.h %DESTROOT%\inc\ReactUWP
%COPYCMD% %SRCROOT%\include %DESTROOT%\inc\include

%COPYCMD% %SRCROOT%\ReactWin32.nuspec %DESTROOT%

0 comments on commit f6e22af

Please sign in to comment.