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

Handle publishing of packages using Yarn Classic #87

Merged
merged 9 commits into from
Jun 12, 2024

Conversation

legobeat
Copy link
Contributor

@legobeat legobeat commented May 22, 2024

This was previously submitted as #17 and has been reworked.

Reopening as collectively hours are wasted trying to identify compatible combination of actions for legacy repos as they transition to automated publishing.

Yes, @metamask/action-npm-publish@1 does work for Yarn Classic use-cases but there are further changes in this action that would benefit those still actively maintained Yarn 1 repos.


  • Feat: Fall back to npm publish / npm pack when yarn>=v3 not available
    • This works regardless of if packages are using npm or yarn as packageManager.
  • CI: Fix skunk-monorepo test to actually test intended behavior
    • The test indicates that it should validate that publishing is skipped because versions are already published. Instead, it just ran yarn pack and never runs the version-checking code.
    • Also adds PUBLISH_NPM_TAG env var to make the test pass
  • Feat: Fall back to recognizing NPM_TOKEN env var if YARN_NPM_TOKEN env var not set
  • Fix: Move set -x to not leak npm token in debug log

scripts/publish.sh Outdated Show resolved Hide resolved
@legobeat legobeat requested a review from mcmire May 22, 2024 03:27
@legobeat legobeat force-pushed the yarn1-publish branch 4 times, most recently from 0b6375b to f108c26 Compare May 27, 2024 00:04
@legobeat legobeat requested review from a team and naugtur May 27, 2024 00:11
@legobeat
Copy link
Contributor Author

legobeat commented May 27, 2024

Noticed that one of the CI tests doesn't actually run the intended code at all, which is also fixed in this PR now. Reviewers: Let me know if you prefer me to split that part (and the associated NPM_TOKEN recognition) out in a separate PR from this one.

@legobeat legobeat force-pushed the yarn1-publish branch 2 times, most recently from 0e67952 to 4a7d6b6 Compare May 27, 2024 02:13
@legobeat legobeat requested review from a team and mikesposito May 27, 2024 20:59
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we had better testing, but in the absence of that, this PR looks good to me. I just had a question for the hypothetical case where we have a Yarn v1 monorepo.

scripts/publish.sh Show resolved Hide resolved
@mcmire
Copy link
Contributor

mcmire commented Jun 11, 2024

Is it possible for you to test this PR on a fork of core, and also a fork of whichever library you've been working with that still uses Yarn v1? As annoying as it is that's the only real way we've been testing these actions so far.

@legobeat
Copy link
Contributor Author

legobeat commented Jun 12, 2024

Is it possible for you to test this PR on a fork of core

Sure, done here. (failing with 404 because the configured NPM_TOKEN is invalid)

, and also a fork of whichever library you've been working with that still uses Yarn v1?

We actually already used a backport of this for publishing @metamask/swaps-controller@9.0.0: https://github.com/MetaMask/swaps-controller/blob/fd532ec67d920384fdaed192a05954f0c3c8800c/.github/workflows/publish-release.yml#L73

Does that suffice?

Let me know if there is any particular other repo you'd like to see tested.

@legobeat legobeat requested a review from mcmire June 12, 2024 02:42
@mcmire
Copy link
Contributor

mcmire commented Jun 12, 2024

@legobeat Oh cool. No that sounds good, thanks for confirming that.

I do see that shellcheck is failing though :/

@legobeat
Copy link
Contributor Author

I do see that shellcheck is failing though :/

@mcmire It fails regardless of PR contents (unrelated) but I have tested it locally.

@mcmire
Copy link
Contributor

mcmire commented Jun 12, 2024

@legobeat Lovely 😫 Well, I have approved now.

@legobeat legobeat merged commit 7cf06c2 into MetaMask:main Jun 12, 2024
11 of 12 checks passed
This pull request was closed.
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