Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(0.76): fix prepublish script inconsistencies #2411

Merged
merged 4 commits into from
Mar 13, 2025

Conversation

Saadnajmi
Copy link
Collaborator

Backport of #2410 to 0.76-stable. I'm also updating the nx config tag.

tido64 and others added 2 commits March 13, 2025 00:44
Addresses inconsistencies in the prepublish script by moving the Azure
Pipelines checks after the correct tag has been determined.

Ensure tag is correctly set on `main`:

```
~/S/react-native-macos (main) % node .ado/scripts/prepublish-check.mjs --verbose
❌ .ado/templates/npm-publish-steps.yml: 'publishTag' needs to be set to 'nightly'
```

Ensure tag is correctly set for `0.76-stable` (previous):

```
~/S/react-native-macos (0.76-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 76
ℹ️ Expected npm tag: v0.76-stable
❌ 'release.version.generatorOptions.currentVersionResolverMetadata.tag' must be set to 'v0.76-stable'
❌ Nx Release is not correctly configured for the current branch
```

Ensure tag is correctly set for `0.77-stable` (current):

```
~/S/react-native-macos (0.77-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 77
ℹ️ Expected npm tag: latest
```

Ensure tag is correctly set for `0.78-stable` (release candidate):

```
~/S/react-native-macos (0.78-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 78
ℹ️ Expected npm tag: next
❌ 'defaultBase' must be set to '0.78-stable'
❌ 'release.version.generatorOptions.preid' must be set to 'rc'
❌ 'release.version.generatorOptions.currentVersionResolverMetadata.tag' must be set to 'next'
❌ Nx Release is not correctly configured for the current branch
```

Update config for `0.78-stable` (release candidate):

```
~/S/react-native-macos (0.78-stable) % node .ado/scripts/prepublish-check.mjs --update
❌ 'defaultBase' must be set to '0.78-stable'
❌ 'release.version.generatorOptions.preid' must be set to 'rc'
❌ 'release.version.generatorOptions.currentVersionResolverMetadata.tag' must be set to 'next'

~/S/react-native-macos (0.78-stable) [1]% node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 78
ℹ️ Expected npm tag: next
❌ .ado/templates/npm-publish-steps.yml: 'publishTag' needs to be set to 'next'
```

Mark `0.78-stable` stable:

```
~/S/react-native-macos (0.78-stable) % node .ado/scripts/prepublish-check.mjs --verbose --tag latest --update
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 78
ℹ️ Expected npm tag: latest
❌ 'defaultBase' must be set to '0.78-stable'

~/S/react-native-macos (0.78-stable) [1]% node .ado/scripts/prepublish-check.mjs --verbose --tag latest
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 78
ℹ️ Expected npm tag: latest
```
@Saadnajmi Saadnajmi requested a review from a team as a code owner March 13, 2025 05:45
tido64 and others added 2 commits March 13, 2025 12:41
## Summary:

When demoting a stable branch, we need to create a new tag. Nx won't be
able to find it on npm and should have a fallback. For all other
branches, we don't want to use the fallback in case something fails.

## Test Plan:

`main`:

```
~/S/react-native-macos (main) % node .ado/scripts/prepublish-check.mjs --verbose
##vso[task.setvariable variable=publish_react_native_macos]1
```

`0.76-stable`:

```
~/S/react-native-macos (0.76-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 76
ℹ️ Expected npm tag: v0.76-stable
❌ 'release.version.generatorOptions.currentVersionResolverMetadata.tag' must be set to 'v0.76-stable'
❌ 'release.version.generatorOptions.fallbackCurrentVersionResolver' must be set to 'disk'
❌ Nx Release is not correctly configured for the current branch
```

`0.77-stable`:

```
~/S/react-native-macos (0.77-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 77
ℹ️ Expected npm tag: latest
❌ 'release.version.generatorOptions.fallbackCurrentVersionResolver' must be unset
❌ Nx Release is not correctly configured for the current branch
```

`0.78-stable`:

```
~/S/react-native-macos (0.78-stable) % node .ado/scripts/prepublish-check.mjs --verbose
ℹ️ react-native-macos@latest: 77
ℹ️ Current version: 78
ℹ️ react-native-macos@next: 76
ℹ️ Expected npm tag: next
❌ 'defaultBase' must be set to '0.78-stable'
❌ 'release.version.generatorOptions.preid' must be set to 'rc'
❌ 'release.version.generatorOptions.currentVersionResolverMetadata.tag' must be set to 'next'
❌ 'release.version.generatorOptions.fallbackCurrentVersionResolver' must be unset
❌ Nx Release is not correctly configured for the current branch
```
@Saadnajmi Saadnajmi merged commit 08264f3 into microsoft:0.76-stable Mar 13, 2025
10 checks passed
@Saadnajmi Saadnajmi deleted the prepublish-76 branch March 13, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants