react-native-macos/.ado/publish.yml

172 строки
6.7 KiB
YAML

# 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/vars.yml
- group: React-native-macos Secrets
- group: InfoSec-SecurityResults
- name: tags
value: production,externalfacing
jobs:
- job: NPMPublishRNM
displayName: NPM Publish React Native macOS
pool:
vmImage: $(VmImageApple)
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
dependsOn:
- Compliance
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/apple-tools-setup.yml
- template: templates/apple-install-dependencies.yml
- template: templates/apple-release-setup.yml
- task: CmdLine@2
displayName: Set next version if release branch
inputs:
script: |
VERSION=$(node .ado/get-next-semver-version.js)
echo "Set version to: $VERSION"
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/main'))
- task: CmdLine@2
displayName: Set latest tag if latest stable branch
inputs:
script: |
LATEST=true
echo "Set latest to: $LATEST"
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/main'))
- task: CmdLine@2
displayName: Set release type to 'nightly'
inputs:
script: |
RELEASE_TYPE=nightly
echo "Set release type to: $RELEASE_TYPE"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
- task: CmdLine@2
displayName: Set release type to 'release'
inputs:
script: |
RELEASE_TYPE=release
echo "Set release type to: $RELEASE_TYPE"
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/main'))
- task: CmdLine@2
displayName: Prepare package for release
inputs:
script: |
if [[ -z "$VERSION" ]]; then
VERSION=$(grep '"version"' package.json | cut -d '"' -f 4 | head -1)
echo "Using the version from the package.json: $VERSION"
fi
node ./scripts/prepare-package-for-release.js -v "$VERSION" -l $LATEST
condition: and(succeeded(), ne(variables['Build.TargetBranch'], 'refs/heads/main'))
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 📒 Generate Manifest
inputs:
BuildDropPath: $(System.DefaultWorkingDirectory)
- task: CmdLine@2
displayName: NPM Publish
inputs:
script: |
node ./scripts/publish-npm.js --$RELEASE_TYPE
- task: PublishPipelineArtifact@1
displayName: 📒 Publish Manifest
inputs:
artifactName: SBom-RNGithubNpmJSPublish-$(System.JobAttempt)
targetPath: $(System.DefaultWorkingDirectory)/_manifest
- job: RNMacOSInitNpmJSPublish
displayName: react-native-macos-init Publish to npmjs.org
pool: cxeiss-ubuntu-20-04-large
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')
dependsOn:
- Compliance
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/apple-tools-setup.yml
- template: templates/apple-install-dependencies.yml
- template: templates/apple-release-setup.yml
- 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 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
# 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
- 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
persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch