2019-04-02 07:23:40 +03:00
# This file defines the build steps to publish a release
2019-03-08 01:57:21 +03:00
name : $(Date:yyyyMMdd).$(Rev:.r)
2022-02-04 19:37:15 +03:00
trigger :
2019-05-01 20:08:31 +03:00
batch : true
branches :
include :
2022-01-07 00:24:34 +03:00
- main
2023-04-03 21:06:17 +03:00
- '*-stable'
2019-05-01 20:10:37 +03:00
paths :
exclude :
- package.json
2019-03-08 01:57:21 +03:00
2019-04-02 07:23:40 +03:00
pr : none
2019-03-08 01:57:21 +03:00
2021-11-01 22:33:19 +03:00
variables :
2024-05-21 21:18:38 +03:00
- template : /.ado/variables/vars.yml@self
2022-03-04 08:40:53 +03:00
- group : React-native-macos Secrets
- group : InfoSec-SecurityResults
- name : tags
value : production,externalfacing
2024-08-30 09:50:25 +03:00
# Remember to update this in previous stable branches when creating a new stable branch
- name : latestStableBranch
value : '0.75-stable'
2021-11-01 22:33:19 +03:00
2023-10-28 03:28:59 +03:00
resources :
repositories :
- repository : OfficePipelineTemplates
type : git
name : 1ESPipelineTemplates/OfficePipelineTemplates
ref : refs/tags/release
extends :
template : v1/Office.Official.PipelineTemplate.yml@OfficePipelineTemplates
parameters :
2020-04-03 21:57:49 +03:00
pool :
2023-10-28 03:28:59 +03:00
name : Azure-Pipelines-1ESPT-ExDShared
image : windows-latest
os : windows
sdl :
eslint :
configuration : 'recommended'
parser : '@typescript-eslint/parser'
parserOptions : ''
enableExclusions : true
# Justification: js files in this repo are flow files. the built-in eslint does not support this. Adding a separate step to run the sdl rules for flow files.
exclusionPatterns : '**/*.js'
credscan :
suppressionsFile : .ado/CredScanSuppressions.json
stages :
- stage : main
jobs :
- job : RNGithubNpmJSPublish
displayName : NPM Publish React-native-macos
pool :
name : Azure Pipelines
vmImage : macos-13
os : macOS
variables :
- name : BUILDSECMON_OPT_IN
value : true
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
templateContext :
outputs :
- output : pipelineArtifact
targetPath : $(System.DefaultWorkingDirectory)
artifactName : github-npm-js-publish
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
# Setup the repo to be ready for release. This includes:
# - Autogenerating the next version number
# - Calling the approprate scripts that upstream React Native uses to prepare a release
# - Skipping the actual `git tag`, `git push`, and `npm publish steps as we do that here instead
2023-10-28 03:37:53 +03:00
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
2024-05-21 21:18:38 +03:00
- template : .ado/templates/apple-steps-publish.yml@self
2023-10-28 03:28:59 +03:00
parameters :
build_type : nightly
- ${{ elseif endsWith(variables['Build.SourceBranchName'], '-stable') }}:
2024-05-21 21:18:38 +03:00
- template : .ado/templates/apple-steps-publish.yml@self
2023-10-28 03:28:59 +03:00
parameters :
build_type : release
- ${{ else }}:
- task : CmdLine@2
displayName : Unknown branch, skipping publish
inputs :
script : |
echo "Skipping publish for branch $(Build.SourceBranchName)"
exit 1
# Set the NPM dist-tag and do the actual NPM publish
- 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))
- task : CmdLine@2
displayName : Actual NPM Publish
inputs :
script : |
npm publish ./packages/react-native --tag $(npmDistTag) --registry https://registry.npmjs.org/ --//registry.npmjs.org/:_authToken=$(npmAuthToken)
# Set the git tag and push the version update back to Github
- template : .ado/templates/configure-git.yml@self
- task : CmdLine@2
displayName : 'Tag and push to Github'
inputs :
script : node .ado/gitTagRelease.js
env :
BUILD_STAGINGDIRECTORY : $(Build.StagingDirectory)
BUILD_SOURCEBRANCH : $(Build.SourceBranch)
SYSTEM_ACCESSTOKEN : $(System.AccessToken)
githubAuthToken : $(githubAuthToken)
condition : and(succeeded(), ne(variables['Build.SourceBranchName'], 'main'))
- job : RNMacOSInitNpmJSPublish
displayName : NPM Publish beachball packages (e.g., react-native-macos-init)
pool :
name : cxeiss-ubuntu-20-04-large
image : cxe-ubuntu-20-04-1es-pt
os : linux
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
templateContext :
outputs :
- output : pipelineArtifact
targetPath : $(System.DefaultWorkingDirectory)
artifactName : macos-init-npm-js-publish
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 : .ado/templates/configure-git.yml@self
- task : CmdLine@2
displayName : yarn install
inputs :
script : |
cd packages/react-native-macos-init
yarn install
- task : CmdLine@2
displayName : Build react-native-macos-init
inputs :
script : |
cd packages/react-native-macos-init
yarn build
- task : CmdLine@2
displayName : Code tested in other pipeline [test]
inputs :
script : echo "This code is tested as part of an integration test. See the 'Verify react-native-macos-init' task."
- task : CmdLine@2
displayName : "Publish beachball packages to npmjs.org"
inputs :
script : |
2023-12-28 00:51:15 +03:00
npx beachball publish --scope '!packages/react-native' --branch origin/$(Build.SourceBranchName) -n $(npmAuthToken) -yes -m "applying package updates ***NO_CI***" --access public