2023-04-24 17:35:58 +03:00
|
|
|
# It is expected that a `latestStableBranch` variable is set in the pipeline's settings:
|
|
|
|
|
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:
|
2022-02-04 19:37:15 +03:00
|
|
|
- template: variables/vars.yml
|
2022-03-04 08:40:53 +03:00
|
|
|
- group: React-native-macos Secrets
|
|
|
|
- group: InfoSec-SecurityResults
|
|
|
|
- name: tags
|
|
|
|
value: production,externalfacing
|
2021-11-01 22:33:19 +03:00
|
|
|
|
2019-03-08 01:57:21 +03:00
|
|
|
jobs:
|
2023-04-04 20:06:42 +03:00
|
|
|
- job: RNGithubNpmJSPublish
|
|
|
|
displayName: NPM Publish React-native-macos
|
2020-04-03 21:57:49 +03:00
|
|
|
pool:
|
2022-02-04 19:37:15 +03:00
|
|
|
vmImage: $(VmImageApple)
|
2022-03-04 08:40:53 +03:00
|
|
|
variables:
|
|
|
|
- name: BUILDSECMON_OPT_IN
|
|
|
|
value: true
|
2020-04-03 21:57:49 +03:00
|
|
|
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
|
2022-03-29 12:13:43 +03:00
|
|
|
dependsOn:
|
2022-03-04 08:40:53 +03:00
|
|
|
- Compliance
|
2020-04-03 21:57:49 +03:00
|
|
|
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
|
|
|
|
|
2023-04-07 04:59:05 +03:00
|
|
|
# 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-04-05 00:16:08 +03:00
|
|
|
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
|
2023-04-04 20:06:42 +03:00
|
|
|
- template: templates/apple-job-publish.yml
|
|
|
|
parameters:
|
|
|
|
build_type: nightly
|
2023-04-05 00:16:08 +03:00
|
|
|
- ${{ elseif endsWith(variables['Build.SourceBranchName'], '-stable') }}:
|
2023-04-04 20:06:42 +03:00
|
|
|
- template: templates/apple-job-publish.yml
|
|
|
|
parameters:
|
|
|
|
build_type: release
|
|
|
|
- ${{ else }}:
|
|
|
|
- task: CmdLine@2
|
|
|
|
displayName: Unknown branch, skipping publish
|
|
|
|
inputs:
|
|
|
|
script: |
|
|
|
|
echo "Skipping publish for branch $(Build.SourceBranchName)"
|
|
|
|
exit 1
|
2021-10-29 01:15:33 +03:00
|
|
|
|
2023-04-07 04:59:05 +03:00
|
|
|
# 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: |
|
2023-08-31 03:11:24 +03:00
|
|
|
npm publish ./packages/react-native --tag $(npmDistTag) --registry https://registry.npmjs.org/ --//registry.npmjs.org/:_authToken=$(npmAuthToken)
|
2023-04-07 04:59:05 +03:00
|
|
|
|
|
|
|
# Set the git tag and push the version update back to Github
|
|
|
|
|
|
|
|
- template: templates/configure-git.yml
|
|
|
|
|
|
|
|
- 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'))
|
2023-04-12 00:43:36 +03:00
|
|
|
|
|
|
|
# Generate and publish the SBOM
|
|
|
|
|
|
|
|
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
|
|
|
displayName: 📒 Generate Manifest
|
|
|
|
inputs:
|
|
|
|
BuildDropPath: $(System.DefaultWorkingDirectory)
|
|
|
|
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
|
|
displayName: 📒 Publish Manifest
|
|
|
|
inputs:
|
|
|
|
artifactName: SBom-RNGithubNpmJSPublish-$(System.JobAttempt)
|
|
|
|
targetPath: $(System.DefaultWorkingDirectory)/_manifest
|
2023-04-07 04:59:05 +03:00
|
|
|
|
|
|
|
|
2020-04-04 08:54:36 +03:00
|
|
|
- job: RNMacOSInitNpmJSPublish
|
2023-08-31 03:11:24 +03:00
|
|
|
displayName: NPM Publish beachball packages (e.g., react-native-macos-init)
|
2022-08-02 04:02:02 +03:00
|
|
|
pool: cxeiss-ubuntu-20-04-large
|
2020-04-04 08:54:36 +03:00
|
|
|
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
|
2022-01-07 00:24:34 +03:00
|
|
|
condition: eq(variables['Build.SourceBranchName'], 'main')
|
2022-03-29 12:13:43 +03:00
|
|
|
dependsOn:
|
2022-03-04 08:40:53 +03:00
|
|
|
- Compliance
|
2020-04-04 08:54:36 +03:00
|
|
|
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
|
|
|
|
|
2023-04-07 04:59:05 +03:00
|
|
|
- template: templates/configure-git.yml
|
2020-04-04 08:54:36 +03:00
|
|
|
|
2023-04-26 23:48:13 +03:00
|
|
|
- task: CmdLine@2
|
|
|
|
displayName: yarn install
|
|
|
|
inputs:
|
|
|
|
script: |
|
|
|
|
cd packages/react-native-macos-init
|
|
|
|
yarn install
|
|
|
|
|
2020-04-04 08:54:36 +03:00
|
|
|
- task: CmdLine@2
|
2023-03-31 21:09:48 +03:00
|
|
|
displayName: Build react-native-macos-init
|
2020-04-04 08:54:36 +03:00
|
|
|
inputs:
|
|
|
|
script: |
|
|
|
|
cd packages/react-native-macos-init
|
|
|
|
yarn build
|
|
|
|
|
2022-03-04 08:40:53 +03:00
|
|
|
- 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."
|
|
|
|
|
2020-04-04 08:54:36 +03:00
|
|
|
- task: CmdLine@2
|
2023-08-31 03:11:24 +03:00
|
|
|
displayName: "Publish beachball packages to npmjs.org"
|
2020-04-04 08:54:36 +03:00
|
|
|
inputs:
|
|
|
|
script: |
|
2023-08-31 03:11:24 +03:00
|
|
|
npx beachball publish --scope '!packages/react-native' --branch origin/$(Build.SourceBranchName) -n $(npmAuthToken) -yes -m "applying package updates ***NO_CI***" --access public
|
2020-04-04 08:54:36 +03:00
|
|
|
|
2022-02-11 07:37:20 +03:00
|
|
|
# beachball modifies the package.json files so run manifest generation after it.
|
|
|
|
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
|
|
|
|
displayName: 📒 Generate Manifest
|
|
|
|
inputs:
|
|
|
|
BuildDropPath: $(System.DefaultWorkingDirectory)
|
|
|
|
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
|
|
displayName: 📒 Publish Manifest
|
|
|
|
inputs:
|
|
|
|
artifactName: SBom-RNMacOSInitNpmJSPublish-$(System.JobAttempt)
|
|
|
|
targetPath: $(System.DefaultWorkingDirectory)/_manifest
|
|
|
|
|
2022-03-04 08:40:53 +03:00
|
|
|
- job: Compliance
|
|
|
|
displayName: React-Native GitHub Compliance pipeline
|
|
|
|
pool: OE-OfficePublic
|
|
|
|
timeoutInMinutes: 15 # how long to run the job before automatically cancelling
|
|
|
|
steps:
|
|
|
|
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
|
|
|
|
clean: true # whether to fetch clean each time
|
|
|
|
fetchDepth: 10 # 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
|
2022-09-30 22:49:17 +03:00
|
|
|
persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch
|