pulsar-edit / pulsar

A Community-led Hyper-Hackable Text Editor
https://pulsar-edit.dev
Other
3.33k stars 140 forks source link

script: Update version check in Rolling release binary upload script to exclude '-dev' versions #903

Closed DeeDeeG closed 9 months ago

DeeDeeG commented 9 months ago

Identify the Bug

The Rolling Release upload script trusts CI to either give it a clean Regular version, e.g. v1.113.0, or a long, timestamped, Rolling version, e.g. v1.113.2024013003.

If someone (me) messes up the CI to where the version in package.json of the repo is somehow still e.g. v1.113.0-dev when the script is run (as I accidentally did in https://github.com/pulsar-edit/pulsar/pull/858), the upload script will attempt to upload a binary based on this not-Rolling-style version string, setting up a tag on the rolling release binaries repo that shouldn't be there, and which potentially keeps getting overwritten multiple times due to the aforementioned (hypothetical, but also presently real) CI screw up persisting on master branch and running again after each PR lands, which I may have hypothetically, but definitely did practically, cause with https://github.com/pulsar-edit/pulsar/pull/858.

Description of the Change

Teach the Rolling release binary upload script to recognize rogue "-dev" version strings that should not be uploaded, and not upload if those version strings are encountered (much like we already correctly do for well-formed Regular release version strings).

Alternate Designs

Maybe I should actually have the script exit with exit code 1 to have CI error, since this isn't a situation we should be in, attempting to upload bins without a proper version number, which screws with our Rolling release repo.

Yeah, maybe I'll go do that instead. Gonna open this as draft, because I need sleep.

Possible Drawbacks

Verification Process

Worked in local testing with a v1.113.0-dev version string.

Script now properly rejects this, instead of over-trustingly assuming it must be a proper Rolling version since "it's not short enough to be a Regular release version."

Any further verification is TBD. Looks like it's working. See: https://github.com/pulsar-edit/pulsar/pull/903#issuecomment-1928839952

Release Notes

Tweak Rolling release binary upload script to reject -dev version strings, as it should.

DeeDeeG commented 9 months ago

This worked!

According to our version: 1.113.0-dev this is not a rolling release... Exiting without changes...

https://github.com/pulsar-edit/pulsar/actions/runs/7794998778/job/21257862924#step:7:33

Looking good to me, and ready for review.