From 86b97233d15f475ebe5f2f629f4196b9871d8a4a Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 4 Dec 2024 17:00:52 -0800 Subject: [PATCH 01/11] ci: Enable publishing of stable releases --- .ado/publish.yml | 63 ---------------------------------- .ado/templates/npm-publish.yml | 5 +-- 2 files changed, 1 insertion(+), 67 deletions(-) diff --git a/.ado/publish.yml b/.ado/publish.yml index 25937ba414b39c..7169e5aef44ccd 100644 --- a/.ado/publish.yml +++ b/.ado/publish.yml @@ -72,66 +72,3 @@ extends: persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch - template: /.ado/templates/npm-publish.yml@self - - # 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: | - npx beachball publish --scope '!packages/react-native' --branch origin/$(Build.SourceBranchName) -n $(npmAuthToken) -yes -m "applying package updates ***NO_CI***" --access public diff --git a/.ado/templates/npm-publish.yml b/.ado/templates/npm-publish.yml index cf2975603c6290..b95467443ec908 100644 --- a/.ado/templates/npm-publish.yml +++ b/.ado/templates/npm-publish.yml @@ -17,10 +17,7 @@ steps: condition: ${{ ne(variables['publish_react_native_macos'], '1') }} - script: | - # TODO: Before we can change the line below to `yarn nx release --yes` on - # `main`, we must first set up the pipeline for nightly builds. Stable - # branches should be fine. - yarn nx release --dry-run + yarn nx release --yes env: GITHUB_TOKEN: $(githubAuthToken) NODE_AUTH_TOKEN: $(npmAuthToken) From aeea310d2f457d5f5a02fc4876e87de88ce8b0bf Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Thu, 5 Dec 2024 14:35:10 -0800 Subject: [PATCH 02/11] ci: check publish_react_native_macos with a runtime condition --- .ado/templates/npm-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ado/templates/npm-publish.yml b/.ado/templates/npm-publish.yml index b95467443ec908..0f2085fe774423 100644 --- a/.ado/templates/npm-publish.yml +++ b/.ado/templates/npm-publish.yml @@ -14,7 +14,7 @@ steps: - script: | yarn nx release --dry-run displayName: Version and publish packages (dry run) - condition: ${{ ne(variables['publish_react_native_macos'], '1') }} + condition: and(succeeded(), ne(variables['publish_react_native_macos'], '1')) - script: | yarn nx release --yes @@ -22,4 +22,4 @@ steps: GITHUB_TOKEN: $(githubAuthToken) NODE_AUTH_TOKEN: $(npmAuthToken) displayName: Version and publish packages - condition: ${{ eq(variables['publish_react_native_macos'], '1') }} + condition: and(succeeded(), eq(variables['publish_react_native_macos'], '1')) From 2f88d4309a1e2d16c9e110f949db6eb18c0f3fb4 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Thu, 5 Dec 2024 14:50:49 -0800 Subject: [PATCH 03/11] ci: add `--verbose` flag to `nx release` --- .ado/templates/npm-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ado/templates/npm-publish.yml b/.ado/templates/npm-publish.yml index 0f2085fe774423..d1e53b098a47d8 100644 --- a/.ado/templates/npm-publish.yml +++ b/.ado/templates/npm-publish.yml @@ -12,12 +12,12 @@ steps: displayName: Verify release config - script: | - yarn nx release --dry-run + yarn nx release --dry-run --verbose displayName: Version and publish packages (dry run) condition: and(succeeded(), ne(variables['publish_react_native_macos'], '1')) - script: | - yarn nx release --yes + yarn nx release --yes --verbose env: GITHUB_TOKEN: $(githubAuthToken) NODE_AUTH_TOKEN: $(npmAuthToken) From 405287f1afb37e6544a71277c8f71f539e56832b Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 6 Dec 2024 11:44:55 -0800 Subject: [PATCH 04/11] chore: don't use `workspace:*` dependencies in react-native-macos --- packages/react-native/package.json | 2 +- yarn.lock | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/react-native/package.json b/packages/react-native/package.json index 100195bbba3fe7..8ab5332d9f04ab 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -112,7 +112,7 @@ }, "dependencies": { "@jest/create-cache-key-function": "^29.6.3", - "@react-native-mac/virtualized-lists": "workspace:*", + "@react-native-mac/virtualized-lists": "0.76.4", "@react-native/assets-registry": "0.76.0-main", "@react-native/codegen": "0.76.0-main", "@react-native/community-cli-plugin": "0.76.0-main", diff --git a/yarn.lock b/yarn.lock index fcc56189a79f71..96482649489bc3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2630,7 +2630,24 @@ __metadata: languageName: unknown linkType: soft -"@react-native-mac/virtualized-lists@workspace:*, @react-native-mac/virtualized-lists@workspace:packages/virtualized-lists": +"@react-native-mac/virtualized-lists@npm:0.76.4": + version: 0.76.4 + resolution: "@react-native-mac/virtualized-lists@npm:0.76.4" + dependencies: + invariant: "npm:^2.2.4" + nullthrows: "npm:^1.1.1" + peerDependencies: + "@types/react": ^18.2.6 + react: "*" + react-native: "*" + peerDependenciesMeta: + "@types/react": + optional: true + checksum: 10c0/896165fc21755502ed6d659510e2f69a69d0c2bd564ccb838dfec6c2d1d84dcd9e4d4ce2f1adddbe91dc4ea627a61dc747efe3f4335a071d88ee8a9cb035d062 + languageName: node + linkType: hard + +"@react-native-mac/virtualized-lists@workspace:packages/virtualized-lists": version: 0.0.0-use.local resolution: "@react-native-mac/virtualized-lists@workspace:packages/virtualized-lists" dependencies: @@ -10576,7 +10593,7 @@ __metadata: resolution: "react-native-macos@workspace:packages/react-native" dependencies: "@jest/create-cache-key-function": "npm:^29.6.3" - "@react-native-mac/virtualized-lists": "workspace:*" + "@react-native-mac/virtualized-lists": "npm:0.76.4" "@react-native/assets-registry": "npm:0.76.0-main" "@react-native/codegen": "npm:0.76.0-main" "@react-native/community-cli-plugin": "npm:0.76.0-main" From 4a38c1d4e13e20edd4829b513af46da41c278601 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 6 Dec 2024 15:28:59 -0800 Subject: [PATCH 05/11] ci: rename `npm-publish` to `npm-publish-steps` --- .ado/scripts/prepublish-check.mjs | 2 +- .ado/templates/{npm-publish.yml => npm-publish-steps.yml} | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) rename .ado/templates/{npm-publish.yml => npm-publish-steps.yml} (93%) diff --git a/.ado/scripts/prepublish-check.mjs b/.ado/scripts/prepublish-check.mjs index baaff5ae5a97aa..83f563dc2a4b16 100644 --- a/.ado/scripts/prepublish-check.mjs +++ b/.ado/scripts/prepublish-check.mjs @@ -3,7 +3,7 @@ import { spawnSync } from "node:child_process"; import * as fs from "node:fs"; import * as util from "node:util"; -const ADO_PUBLISH_PIPELINE = ".ado/templates/npm-publish.yml"; +const ADO_PUBLISH_PIPELINE = ".ado/templates/npm-publish-steps.yml"; const NX_CONFIG_FILE = "nx.json"; const NPM_TAG_NEXT = "next"; diff --git a/.ado/templates/npm-publish.yml b/.ado/templates/npm-publish-steps.yml similarity index 93% rename from .ado/templates/npm-publish.yml rename to .ado/templates/npm-publish-steps.yml index d1e53b098a47d8..868bcead7b1bac 100644 --- a/.ado/templates/npm-publish.yml +++ b/.ado/templates/npm-publish-steps.yml @@ -3,6 +3,8 @@ parameters: publishTag: 'next' steps: + - template: /.ado/templates/configure-git.yml@self + - script: | yarn install displayName: Install npm dependencies From d8ca200bc907718fa9ebec78a969e709f8835dbe Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 6 Dec 2024 15:29:14 -0800 Subject: [PATCH 06/11] ci: move xcode-select into apple-tools-setup --- .ado/templates/apple-tools-setup.yml | 4 ++++ .ado/templates/apple-xcode-select.yml | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 .ado/templates/apple-xcode-select.yml diff --git a/.ado/templates/apple-tools-setup.yml b/.ado/templates/apple-tools-setup.yml index 9b82f6e1858025..41dacaaa50b3a4 100644 --- a/.ado/templates/apple-tools-setup.yml +++ b/.ado/templates/apple-tools-setup.yml @@ -7,4 +7,8 @@ steps: brew bundle --file .ado/Brewfile displayName: 'Install Homebrew dependencies' + - script: | + sudo xcode-select --switch $(xcode_version) + displayName: Use $(xcode_friendly_name) + - template: /.ado/templates/apple-xcode-select.yml@self diff --git a/.ado/templates/apple-xcode-select.yml b/.ado/templates/apple-xcode-select.yml deleted file mode 100644 index 5cbc4e4301b047..00000000000000 --- a/.ado/templates/apple-xcode-select.yml +++ /dev/null @@ -1,5 +0,0 @@ -steps: - - bash: | - sudo xcode-select --switch $(xcode_version) - displayName: Use $(xcode_friendly_name) - failOnStderr: true From 6486bbb9ec7dcaad6063b0949fc55a94fe1bf0f1 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:44:50 +0100 Subject: [PATCH 07/11] ci: switch branch before publishing artifacts (#2317) --- .ado/templates/npm-publish-steps.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ado/templates/npm-publish-steps.yml b/.ado/templates/npm-publish-steps.yml index 868bcead7b1bac..b37127b55d9cba 100644 --- a/.ado/templates/npm-publish-steps.yml +++ b/.ado/templates/npm-publish-steps.yml @@ -14,11 +14,13 @@ steps: displayName: Verify release config - script: | + echo Target branch: $(System.PullRequest.TargetBranch) yarn nx release --dry-run --verbose displayName: Version and publish packages (dry run) condition: and(succeeded(), ne(variables['publish_react_native_macos'], '1')) - script: | + git switch $(Build.SourceBranchName) yarn nx release --yes --verbose env: GITHUB_TOKEN: $(githubAuthToken) From 4f451f4a93d22b0469541b9a5e92a62abcb0c72b Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Fri, 6 Dec 2024 16:20:06 -0800 Subject: [PATCH 08/11] ci: split out `nx release publish` into a separate call --- .ado/templates/npm-publish-steps.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ado/templates/npm-publish-steps.yml b/.ado/templates/npm-publish-steps.yml index b37127b55d9cba..4a1e40956902b7 100644 --- a/.ado/templates/npm-publish-steps.yml +++ b/.ado/templates/npm-publish-steps.yml @@ -21,7 +21,8 @@ steps: - script: | git switch $(Build.SourceBranchName) - yarn nx release --yes --verbose + yarn nx release --skip-publish --verbose + yarn nx release publish --excludeTaskDependencies env: GITHUB_TOKEN: $(githubAuthToken) NODE_AUTH_TOKEN: $(npmAuthToken) From 85061efc4c2760f487ca8354713c7db870018282 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 11 Dec 2024 11:59:43 -0800 Subject: [PATCH 09/11] Update npm publish template path in YAML --- .ado/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ado/publish.yml b/.ado/publish.yml index 7169e5aef44ccd..53f94091e590d6 100644 --- a/.ado/publish.yml +++ b/.ado/publish.yml @@ -71,4 +71,4 @@ extends: fetchFilter: blob:none # partial clone for faster clones while maintaining history persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch - - template: /.ado/templates/npm-publish.yml@self + - template: /.ado/templates/npm-publish-steps.yml@self From 666ad3e9114505c53af6d81e84c2cf363bf6758f Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Tue, 14 Jan 2025 16:55:45 -0800 Subject: [PATCH 10/11] back to workspace:* --- packages/react-native/package.json | 2 +- yarn.lock | 21 ++------------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/packages/react-native/package.json b/packages/react-native/package.json index 8ab5332d9f04ab..100195bbba3fe7 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -112,7 +112,7 @@ }, "dependencies": { "@jest/create-cache-key-function": "^29.6.3", - "@react-native-mac/virtualized-lists": "0.76.4", + "@react-native-mac/virtualized-lists": "workspace:*", "@react-native/assets-registry": "0.76.0-main", "@react-native/codegen": "0.76.0-main", "@react-native/community-cli-plugin": "0.76.0-main", diff --git a/yarn.lock b/yarn.lock index 96482649489bc3..fcc56189a79f71 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2630,24 +2630,7 @@ __metadata: languageName: unknown linkType: soft -"@react-native-mac/virtualized-lists@npm:0.76.4": - version: 0.76.4 - resolution: "@react-native-mac/virtualized-lists@npm:0.76.4" - dependencies: - invariant: "npm:^2.2.4" - nullthrows: "npm:^1.1.1" - peerDependencies: - "@types/react": ^18.2.6 - react: "*" - react-native: "*" - peerDependenciesMeta: - "@types/react": - optional: true - checksum: 10c0/896165fc21755502ed6d659510e2f69a69d0c2bd564ccb838dfec6c2d1d84dcd9e4d4ce2f1adddbe91dc4ea627a61dc747efe3f4335a071d88ee8a9cb035d062 - languageName: node - linkType: hard - -"@react-native-mac/virtualized-lists@workspace:packages/virtualized-lists": +"@react-native-mac/virtualized-lists@workspace:*, @react-native-mac/virtualized-lists@workspace:packages/virtualized-lists": version: 0.0.0-use.local resolution: "@react-native-mac/virtualized-lists@workspace:packages/virtualized-lists" dependencies: @@ -10593,7 +10576,7 @@ __metadata: resolution: "react-native-macos@workspace:packages/react-native" dependencies: "@jest/create-cache-key-function": "npm:^29.6.3" - "@react-native-mac/virtualized-lists": "npm:0.76.4" + "@react-native-mac/virtualized-lists": "workspace:*" "@react-native/assets-registry": "npm:0.76.0-main" "@react-native/codegen": "npm:0.76.0-main" "@react-native/community-cli-plugin": "npm:0.76.0-main" From 133da70bfa12239b5bc2b105bbb31511489705db Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 15 Jan 2025 10:14:31 -0800 Subject: [PATCH 11/11] downloadAllPlatforms --- .ado/jobs/npm-publish-dry-run.yml | 3 ++- .ado/templates/apple-tools-setup.yml | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.ado/jobs/npm-publish-dry-run.yml b/.ado/jobs/npm-publish-dry-run.yml index 7c86654ae5a5bd..dd77abda159c0b 100644 --- a/.ado/jobs/npm-publish-dry-run.yml +++ b/.ado/jobs/npm-publish-dry-run.yml @@ -11,4 +11,5 @@ jobs: fetchFilter: blob:none # partial clone for faster clones while maintaining history persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch - - template: /.ado/templates/npm-publish.yml@self + - template: /.ado/templates/npm-publish-steps.yml@self + diff --git a/.ado/templates/apple-tools-setup.yml b/.ado/templates/apple-tools-setup.yml index 41dacaaa50b3a4..f001e1b99bdcd8 100644 --- a/.ado/templates/apple-tools-setup.yml +++ b/.ado/templates/apple-tools-setup.yml @@ -11,4 +11,7 @@ steps: sudo xcode-select --switch $(xcode_version) displayName: Use $(xcode_friendly_name) - - template: /.ado/templates/apple-xcode-select.yml@self + - script: | + xcodebuild -downloadAllPlatforms + sudo xcodebuild -runFirstLaunch + displayName: 'Download Xcode Platforms'