207 строки
8.7 KiB
YAML
207 строки
8.7 KiB
YAML
# It is expected that a `latestStableBranch` variable is set in the pipeline's settings:
|
|
# https://dev.azure.com/ms/react-native/_apps/hub/ms.vss-build-web.ci-designer-hub?pipelineId=221
|
|
|
|
# This file defines the build steps to publish a release
|
|
name: $(Date:yyyyMMdd).$(Rev:.r)
|
|
|
|
trigger:
|
|
batch: true
|
|
branches:
|
|
include:
|
|
- main
|
|
- '*-stable'
|
|
paths:
|
|
exclude:
|
|
- package.json
|
|
|
|
pr: none
|
|
|
|
variables:
|
|
- template: variables/mac.yml
|
|
|
|
jobs:
|
|
- job: RNGithubNpmJSPublish
|
|
displayName: React-Native GitHub Publish to npmjs.org
|
|
pool:
|
|
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:
|
|
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
|
clean: true # whether to fetch clean each time
|
|
# fetchDepth: 2 # the depth of commits to ask Git to fetch
|
|
lfs: false # whether to download Git-LFS files
|
|
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
|
|
|
|
- script: exit 1
|
|
displayName: Validate variables
|
|
condition: eq(variables.latestStableBranch, '')
|
|
|
|
- bash: echo "##vso[task.setvariable variable=npmDistTag]latest"
|
|
displayName: Set dist-tag to latest
|
|
condition: eq(variables['Build.SourceBranchName'], variables.latestStableBranch)
|
|
|
|
- bash: echo "##vso[task.setvariable variable=npmDistTag]canary"
|
|
displayName: Set dist-tag to canary
|
|
condition: eq(variables['Build.SourceBranchName'], 'main')
|
|
|
|
- bash: echo "##vso[task.setvariable variable=npmDistTag]v${{variables['Build.SourceBranchName']}}"
|
|
displayName: Set dist-tag to v0.x-stable
|
|
condition: and(ne(variables['Build.SourceBranchName'], 'main'), ne(variables['Build.SourceBranchName'], variables.latestStableBranch))
|
|
|
|
- template: templates/apple-node-setup.yml
|
|
|
|
- task: CmdLine@2
|
|
displayName: yarn install
|
|
inputs:
|
|
script: yarn install --frozen-lockfile
|
|
|
|
- task: CmdLine@2
|
|
displayName: Bump stable package version
|
|
inputs:
|
|
script: node .ado/bumpFileVersions.js
|
|
condition: and(succeeded(), ne(variables['Build.SourceBranchName'], 'main'))
|
|
|
|
- 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'], 'main'))
|
|
|
|
- task: CmdLine@2
|
|
displayName: Bump canary package version
|
|
inputs:
|
|
script: node scripts/bump-oss-version.js --nightly
|
|
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'main'))
|
|
|
|
# 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
|
|
|
|
- script: npm publish --tag $(npmDistTag) --registry https://registry.npmjs.org/ --//registry.npmjs.org/:_authToken=$(npmAuthToken)
|
|
displayName: Publish react-native-macos to npmjs.org
|
|
|
|
# Put the private flag back so that the removal does not get committed by the tag release step
|
|
- task: CmdLine@2
|
|
displayName: Restore package.json workspace config
|
|
inputs:
|
|
script: node .ado/restoreWorkspaceConfig.js
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Tag published release'
|
|
inputs:
|
|
script: node .ado/gitTagRelease.js
|
|
env:
|
|
BUILD_STAGINGDIRECTORY: $(Build.StagingDirectory)
|
|
BUILD_SOURCEBRANCH: $(Build.SourceBranch)
|
|
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
|
githubApiToken: $(githubApiToken)
|
|
condition: and(succeeded(), ne(variables['Build.SourceBranchName'], 'main'))
|
|
|
|
|
|
- job: RNMacOSInitNpmJSPublish
|
|
displayName: react-native-macos-init Publish to npmjs.org
|
|
pool:
|
|
vmImage: vs2017-win2016
|
|
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
|
|
condition: eq(variables['Build.SourceBranchName'], 'main')
|
|
steps:
|
|
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
|
clean: true # whether to fetch clean each time
|
|
# fetchDepth: 2 # the depth of commits to ask Git to fetch
|
|
lfs: false # whether to download Git-LFS files
|
|
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
|
|
|
|
- template: templates/configure-git.yml
|
|
|
|
- task: CmdLine@2
|
|
displayName: yarn install
|
|
inputs:
|
|
script: |
|
|
cd packages/react-native-macos-init
|
|
yarn install
|
|
|
|
- task: CmdLine@2
|
|
displayName: yarn build
|
|
inputs:
|
|
script: |
|
|
cd packages/react-native-macos-init
|
|
yarn build
|
|
|
|
- task: CmdLine@2
|
|
displayName: "Publish react-native-macos-init to npmjs.org"
|
|
inputs:
|
|
script: |
|
|
npx beachball publish --branch origin/$(Build.SourceBranchName) -n $(npmAuthToken) -yes -m "applying package updates ***NO_CI***" --access public
|
|
|
|
- job: RNGithubOfficePublish
|
|
displayName: React-Native GitHub Publish to Office
|
|
pool:
|
|
vmImage: ubuntu-18.04
|
|
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:
|
|
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
|
clean: true # whether to fetch clean each time
|
|
# fetchDepth: 2 # the depth of commits to ask Git to fetch
|
|
lfs: false # whether to download Git-LFS files
|
|
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
|
|
|
|
- template: templates/android-build-office.yml
|
|
|
|
- task: CmdLine@2
|
|
displayName: Bump package version
|
|
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:
|
|
script: REACT_NATIVE_BOOST_PATH=$(System.DefaultWorkingDirectory)/build_deps ./gradlew installArchives -Pparam="excludeLibs"
|
|
|
|
- template: templates\prep-android-nuget.yml
|
|
|
|
# Enumerate and download all dependencies ..
|
|
- task: CmdLine@2
|
|
displayName: 'Verify Dependencies can be enumerated'
|
|
inputs:
|
|
script: sudo apt-get install python3-pip && sudo apt-get install python3-setuptools && pip3 install BeautifulSoup4 && pip3 install wheel && pip3 install wget && python3 android-patches/scripts/downloadDependencies.py $(Build.SourcesDirectory) && tree $(Build.SourcesDirectory)/android
|
|
|
|
|
|
# Very similar to the default pack task .. but appends 'ndk21b' to the nuget pack version
|
|
- task: CmdLine@2
|
|
displayName: 'NuGet pack'
|
|
inputs:
|
|
script: NDK=ndk`cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | awk '{ print $3}' | awk -F. '{ print $1 }'`; mono $(System.DefaultWorkingDirectory)/nuget-bin/nuget.exe pack $(System.DefaultWorkingDirectory)/ReactAndroid/ReactAndroid.nuspec -OutputDirectory $(Build.StagingDirectory)/final -Properties buildNumber=$(buildNumber)-$NDK;commitId=$(Build.SourceVersion)
|
|
|
|
- task: CmdLine@2
|
|
displayName: 'Npm pack'
|
|
inputs:
|
|
script: node .ado/npmOfficePack.js
|
|
env:
|
|
BUILD_STAGINGDIRECTORY: $(Build.StagingDirectory)
|
|
BUILD_SOURCESDIRECTORY: $(Build.SourcesDirectory)
|
|
BUILD_SOURCEBRANCH: $(Build.SourceBranch)
|
|
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
|
githubApiToken: $(githubApiToken)
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish final artifacts'
|
|
inputs:
|
|
PathtoPublish: '$(Build.StagingDirectory)/final'
|
|
ArtifactName: 'ReactNative-Final'
|