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

Refactor publish pipeline (Take 4) #1777

Merged
merged 1 commit into from
Apr 7, 2023
Merged

Refactor publish pipeline (Take 4) #1777

merged 1 commit into from
Apr 7, 2023

Conversation

Saadnajmi
Copy link
Collaborator

@Saadnajmi Saadnajmi commented Apr 6, 2023

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

We still had NPM publish problems... and after lots of testing, I believe I have found the fix.
The previous refactors attempted to use the nodejs scripts from React Native Core to perform tasks like git tag, git push, and npm publish. However, for whatever reason when those scripts are run in Azure Pipelines, they don't have access our secrets (AKA: githubAuthToken, and npmAuthToken), and those steps would always fail. This is partially because (as I learned), you must explicitly pass secrets down to each individual step as an environment variable, even if they're already set elsewhere (soemthing about scoping of variables to individual tasks..).

So now, we do the following:

  • run prepare-package-for-release.js as a dry-run so it skips the git tag / git push phase
  • Comment out the actual npm publish from publish-npm.js
  • Add extra steps to .ado/publish.yml that do the git tag / git push / npm publish instead. This involved bringing back some files I had deleted in earlier takes of the refactor 😅.
  • Add an extra step to .ado/configure-git.yml to give rnbot push permissions as that was missing. This is taken from [0.68.69] Bump version numbers #1776.
  • Add a bunch of comments to .ado/publish.yml so hopefully the git history is less confusing 🥲

Changelog

[INTERNAL] [FIXED] - Refactor publish pipeline (Take 4)

Test Plan

I ran these changes (with some modifications to fake the branch name / release type) and successfully published both a nightly and 0.71.0 to NPM. I also tested the git push bit by seeing if I I could have rnbot push to a test branch.

@Saadnajmi Saadnajmi requested a review from a team as a code owner April 6, 2023 02:03
@github-actions
Copy link

github-actions bot commented Apr 6, 2023

Warnings
⚠️

scripts/publish-npm.js#L54 - scripts/publish-npm.js line 54 – 'otp' is assigned a value but never used. (no-unused-vars)

⚠️

scripts/publish-npm.js#L112 - scripts/publish-npm.js line 112 – 'major' is assigned a value but never used. (no-unused-vars)

⚠️

scripts/publish-npm.js#L112 - scripts/publish-npm.js line 112 – 'minor' is assigned a value but never used. (no-unused-vars)

⚠️

scripts/publish-npm.js#L112 - scripts/publish-npm.js line 112 – 'prerelease' is assigned a value but never used. (no-unused-vars)

⚠️

scripts/publish-npm.js#L160 - scripts/publish-npm.js line 160 – 'isLatest' is assigned a value but never used. (no-unused-vars)

Generated by 🚫 dangerJS against be5312a

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