ci: setup npm auto deprecate workflow #6520
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please describe the changes this PR makes and why it should be merged:
TL;DR: Script to automatically deprecate older npm versions, runs on a cron job of 01:00 UTC
Quite a while ago now, around the time we introduced auto published dev builds, we had a discussion in prof chat about how to handle old "dev" versions. From that spawned changes to the dev publisher to first deprecate and then publish a new version. A near perfect solution, but as seen at the time of writing, not a flawless one. This what NPM versions tab currently looks like:
Back then I mentioned how I would be working on a utility that could automatically deprecate versions as based on what I could get as info from
registry.npmjs.com
. Well I finally had time to make it now that I have vacation, so here it is.This new workflow will run every night at 01:00 UTC. It scans all the versions that are on NPM and filters out those that:
--name
option (uses the micromatch lib)So given the earlier screenshot that means that only the boxed version would get matched and deprecated with this script:
As as aside, this CLI tool can also be used to manually bulk deprecate versions if needed in the future (i.e. deprecating whole v13 when we go v14 with
--name "13*"
) but just keep in mind that it is not capable of prompting for NPM OTP so it must be used with an NPM Automation Token in your Env vars asNODE_AUTH_TOKEN
I have tested the CLI tool against all of Sapphire's current packages, successfully deprecating many old versions there.
Lastly, for now I pass the options as CLI flags. The tool can also read a JSON or YAML config file in the project root, so if that is preferable let me know and I'll make the change.
Status and versioning classification: