-
Notifications
You must be signed in to change notification settings - Fork 10
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
[fei6062.releaseprotections] Update prepublish checks to add SNAPSHOT_RELEASE support #2412
Conversation
🦋 Changeset detectedLatest commit: cdd7188 The changes in this PR will be included in the next version bump. This PR includes changesets to release 31 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
Size Change: 0 B Total Size: 96.3 kB ℹ️ View Unchanged
|
A new build was pushed to Chromatic! 🚀https://5e1bf4b385e3fb0020b7073c-lvssletngb.chromatic.com/ Chromatic results:
|
npm Snapshot: Published🎉 Good news!! We've packaged up the latest commit from this PR (275c143) and published all packages with changesets to npm. You can install the packages in webapp by running: ./services/static/dev/tools/deploy_wonder_blocks.js --tag="PR2412" Packages can also be installed manually by running: yarn add @khanacademy/wonder-blocks-<package-name>@PR2412 |
The changeset error is too sensitive. These changes don't need releasing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: This isn't a big a change as it's making out.
utils/publish/pre-publish-utils.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: This isn't as big a change as it's making out.
// Get the root folder; use the LICENSE file as our root anchor. | ||
const rootDir = ancesdir(__dirname, "LICENSE"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Other than making it so all checks are run before exiting (this is copied from Perseus and tested), this is the biggest change that isn't in Perseus - using ancesdir to locate the root directory rather than hard-coding it. This way it'll work if the file gets moved around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 🚀
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2412 +/- ##
============================
============================
Continue to review full report in Codecov by Sentry.
|
Summary:
This brings over the latest updates from Perseus, and edits them for Wonder Blocks. The changes are:
prepublishOnly
script in each package that blocks publishing non-snapshot packages when publishing snapshotsSNAPSHOT_RELEASE
env varpre-publish-check-ci.js
andpre-publish-utils.js
files to TypeScriptpre-publish-check-ci.ts
executablepre-publish-check-ci.ts
to ensure that each public package has theprepublishOnly
scriptpre-publish-utils.ts
andpre-publish-check-ci.ts
to perform all checks before erroring, instead of quitting on the first failure. This is a quality of life change to make it easier on devs having to update multiple packages to conformLong term, might be nice to have a
wonder-stuff-cli
or something that can encapsulate this stuff across our packages.This change adds initial protection against accidentally publishing release package versions under a snapshot tag. It protects both automated runs and runs done by a user locally.
The next PR will add workflow changes to block the snapshot publish jobs from running when there is a release workflow in progress. This adds an additional layer of protection and also provides a nicer dev experience by adding a useful PR comment on why it failed.
Methodology:
I diffed the Perseus and Wonder Blocks scripts to work out what was different, then updated things to TS. I then modified the publish script and workflows, as necessary. Finally, I used Copilot Edits in VSCode to update the package.json files with the new
prepublishOnly
script.Issue: FEI-6062
Test plan:
This stuff is working in Perseus already. I've tested the new executable nature of the pre-publish checks, and verified the
SNAPSHOT_RELEASE
behavior for packages by runningSNAPSHOT_RELEASE=1 yarn run prepublishOnly
in a few packages.