-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fei6062.releaseprotections] Update prepublish checks to add SNAPSHOT…
…_RELEASE support (#2412) ## Summary: This brings over the latest updates from Perseus, and edits them for Wonder Blocks. The changes are: 1. New `prepublishOnly` script in each package that blocks publishing non-snapshot packages when publishing snapshots 2. Updates 'publish-snapshot.sh' to set the `SNAPSHOT_RELEASE` env var 3. Updates `pre-publish-check-ci.js` and `pre-publish-utils.js` files to TypeScript 4. Makes `pre-publish-check-ci.ts` executable 5. Adds a check to `pre-publish-check-ci.ts` to ensure that each public package has the `prepublishOnly` script 6. Updates `pre-publish-utils.ts` and `pre-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 conform Long 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 running `SNAPSHOT_RELEASE=1 yarn run prepublishOnly` in a few packages. Author: somewhatabstract Reviewers: somewhatabstract, jandrade Required Reviewers: Approved By: jandrade Checks: ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 2/2), ✅ Test / Test (ubuntu-latest, 20.x, 1/2), ✅ Lint / Lint (ubuntu-latest, 20.x), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ⏭️ Chromatic - Skip on Release PR (changesets), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ⏭️ dependabot, ✅ gerald Pull Request URL: #2412
- Loading branch information
1 parent
c58e3fa
commit 11a0f5c
Showing
43 changed files
with
286 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
"@khanacademy/wonder-blocks-progress-spinner": patch | ||
"@khanacademy/wonder-blocks-birthday-picker": patch | ||
"@khanacademy/wonder-blocks-labeled-field": patch | ||
"@khanacademy/wonder-blocks-search-field": patch | ||
"@khanacademy/wonder-blocks-testing-core": patch | ||
"@khanacademy/wonder-blocks-breadcrumbs": patch | ||
"@khanacademy/wonder-blocks-icon-button": patch | ||
"@khanacademy/wonder-blocks-typography": patch | ||
"@khanacademy/wonder-blocks-accordion": patch | ||
"@khanacademy/wonder-blocks-clickable": patch | ||
"@khanacademy/wonder-blocks-dropdown": patch | ||
"@khanacademy/wonder-blocks-popover": patch | ||
"@khanacademy/wonder-blocks-testing": patch | ||
"@khanacademy/wonder-blocks-theming": patch | ||
"@khanacademy/wonder-blocks-toolbar": patch | ||
"@khanacademy/wonder-blocks-tooltip": patch | ||
"@khanacademy/wonder-blocks-banner": patch | ||
"@khanacademy/wonder-blocks-button": patch | ||
"@khanacademy/wonder-blocks-layout": patch | ||
"@khanacademy/wonder-blocks-switch": patch | ||
"@khanacademy/wonder-blocks-timing": patch | ||
"@khanacademy/wonder-blocks-tokens": patch | ||
"@khanacademy/wonder-blocks-modal": patch | ||
"@khanacademy/wonder-blocks-cell": patch | ||
"@khanacademy/wonder-blocks-core": patch | ||
"@khanacademy/wonder-blocks-data": patch | ||
"@khanacademy/wonder-blocks-form": patch | ||
"@khanacademy/wonder-blocks-grid": patch | ||
"@khanacademy/wonder-blocks-icon": patch | ||
"@khanacademy/wonder-blocks-link": patch | ||
"@khanacademy/wonder-blocks-pill": patch | ||
--- | ||
|
||
No functional changes. Adding prepublishOnly script. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Check if SNAPSHOT_RELEASE is set and the version does not start with 0.0.0-PR | ||
if [ "$SNAPSHOT_RELEASE" = "1" ] && ! [[ "$npm_package_version" =~ ^0\.0\.0-PR ]]; then | ||
echo "Error: Snapshot publish attempted, but $npm_package_name@$npm_package_version does not match version scheme for snapshots. Publish disallowed." | ||
exit 1 | ||
fi |
Oops, something went wrong.