Skip to content

Commit c80cf78

Browse files
Saadnajmitido64
andauthored
ci: bring publish pipeline updates from 0.76-stable to main (#2314)
* ci: Enable publishing of stable releases * ci: check publish_react_native_macos with a runtime condition * ci: add `--verbose` flag to `nx release` * chore: don't use `workspace:*` dependencies in react-native-macos * ci: rename `npm-publish` to `npm-publish-steps` * ci: move xcode-select into apple-tools-setup * ci: switch branch before publishing artifacts (#2317) * ci: split out `nx release publish` into a separate call * Update npm publish template path in YAML * back to workspace:* * downloadAllPlatforms --------- Co-authored-by: Tommy Nguyen <[email protected]>
1 parent 1f83f4e commit c80cf78

File tree

6 files changed

+21
-79
lines changed

6 files changed

+21
-79
lines changed

.ado/jobs/npm-publish-dry-run.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ jobs:
1111
fetchFilter: blob:none # partial clone for faster clones while maintaining history
1212
persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch
1313

14-
- template: /.ado/templates/npm-publish.yml@self
14+
- template: /.ado/templates/npm-publish-steps.yml@self
15+

.ado/publish.yml

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -71,67 +71,4 @@ extends:
7171
fetchFilter: blob:none # partial clone for faster clones while maintaining history
7272
persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch
7373

74-
- template: /.ado/templates/npm-publish.yml@self
75-
76-
# Set the git tag and push the version update back to Github
77-
78-
- template: .ado/templates/configure-git.yml@self
79-
80-
- task: CmdLine@2
81-
displayName: 'Tag and push to Github'
82-
inputs:
83-
script: node .ado/gitTagRelease.js
84-
env:
85-
BUILD_STAGINGDIRECTORY: $(Build.StagingDirectory)
86-
BUILD_SOURCEBRANCH: $(Build.SourceBranch)
87-
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
88-
githubAuthToken: $(githubAuthToken)
89-
condition: and(succeeded(), ne(variables['Build.SourceBranchName'], 'main'))
90-
91-
- job: RNMacOSInitNpmJSPublish
92-
displayName: NPM Publish beachball packages (e.g., react-native-macos-init)
93-
pool:
94-
name: cxeiss-ubuntu-20-04-large
95-
image: cxe-ubuntu-20-04-1es-pt
96-
os: linux
97-
timeoutInMinutes: 90 # how long to run the job before automatically cancelling
98-
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them
99-
templateContext:
100-
outputs:
101-
- output: pipelineArtifact
102-
targetPath: $(System.DefaultWorkingDirectory)
103-
artifactName: macos-init-npm-js-publish
104-
steps:
105-
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
106-
clean: true # whether to fetch clean each time
107-
# fetchDepth: 2 # the depth of commits to ask Git to fetch
108-
lfs: false # whether to download Git-LFS files
109-
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
110-
persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch
111-
112-
- template: .ado/templates/configure-git.yml@self
113-
114-
- task: CmdLine@2
115-
displayName: yarn install
116-
inputs:
117-
script: |
118-
cd packages/react-native-macos-init
119-
yarn install
120-
121-
- task: CmdLine@2
122-
displayName: Build react-native-macos-init
123-
inputs:
124-
script: |
125-
cd packages/react-native-macos-init
126-
yarn build
127-
128-
- task: CmdLine@2
129-
displayName: Code tested in other pipeline [test]
130-
inputs:
131-
script: echo "This code is tested as part of an integration test. See the 'Verify react-native-macos-init' task."
132-
133-
- task: CmdLine@2
134-
displayName: "Publish beachball packages to npmjs.org"
135-
inputs:
136-
script: |
137-
npx beachball publish --scope '!packages/react-native' --branch origin/$(Build.SourceBranchName) -n $(npmAuthToken) -yes -m "applying package updates ***NO_CI***" --access public
74+
- template: /.ado/templates/npm-publish-steps.yml@self

.ado/scripts/prepublish-check.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { spawnSync } from "node:child_process";
33
import * as fs from "node:fs";
44
import * as util from "node:util";
55

6-
const ADO_PUBLISH_PIPELINE = ".ado/templates/npm-publish.yml";
6+
const ADO_PUBLISH_PIPELINE = ".ado/templates/npm-publish-steps.yml";
77
const NX_CONFIG_FILE = "nx.json";
88

99
const NPM_TAG_NEXT = "next";

.ado/templates/apple-tools-setup.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,11 @@ steps:
77
brew bundle --file .ado/Brewfile
88
displayName: 'Install Homebrew dependencies'
99
10-
- template: /.ado/templates/apple-xcode-select.yml@self
10+
- script: |
11+
sudo xcode-select --switch $(xcode_version)
12+
displayName: Use $(xcode_friendly_name)
13+
14+
- script: |
15+
xcodebuild -downloadAllPlatforms
16+
sudo xcodebuild -runFirstLaunch
17+
displayName: 'Download Xcode Platforms'

.ado/templates/apple-xcode-select.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.ado/templates/npm-publish.yml renamed to .ado/templates/npm-publish-steps.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ parameters:
33
publishTag: 'next'
44

55
steps:
6+
- template: /.ado/templates/configure-git.yml@self
7+
68
- script: |
79
yarn install
810
displayName: Install npm dependencies
@@ -12,17 +14,17 @@ steps:
1214
displayName: Verify release config
1315
1416
- script: |
15-
yarn nx release --dry-run
17+
echo Target branch: $(System.PullRequest.TargetBranch)
18+
yarn nx release --dry-run --verbose
1619
displayName: Version and publish packages (dry run)
17-
condition: ${{ ne(variables['publish_react_native_macos'], '1') }}
20+
condition: and(succeeded(), ne(variables['publish_react_native_macos'], '1'))
1821
1922
- script: |
20-
# TODO: Before we can change the line below to `yarn nx release --yes` on
21-
# `main`, we must first set up the pipeline for nightly builds. Stable
22-
# branches should be fine.
23-
yarn nx release --dry-run
23+
git switch $(Build.SourceBranchName)
24+
yarn nx release --skip-publish --verbose
25+
yarn nx release publish --excludeTaskDependencies
2426
env:
2527
GITHUB_TOKEN: $(githubAuthToken)
2628
NODE_AUTH_TOKEN: $(npmAuthToken)
2729
displayName: Version and publish packages
28-
condition: ${{ eq(variables['publish_react_native_macos'], '1') }}
30+
condition: and(succeeded(), eq(variables['publish_react_native_macos'], '1'))

0 commit comments

Comments
 (0)