-
Notifications
You must be signed in to change notification settings - Fork 222
chore: update beta release workflow to use snapshots #5365
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
base: main
Are you sure you want to change the base?
Conversation
|
Branch previewReview the following VRT differencesWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
If the changes are expected, update the |
Tachometer resultsCurrently, no packages are changed by this PR... |
"ignore": [] | ||
"ignore": [], | ||
"snapshot": { | ||
"useCalculatedVersion": true, |
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.
When changesets version --snapshot
is used, the default behavior is to use 0.0.0
as the base version for the snapshot release.
Setting useCalculatedVersion: true
will change the default behavior and will use the calculated version, based on the changeset files.
"ignore": [], | ||
"snapshot": { | ||
"useCalculatedVersion": true, | ||
"prereleaseTemplate": "{tag}.{datetime}" |
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.
This configures the suffix for the snapshot releases, using a template with placeholders.
I decided for tag.datetime
, which seems to be a common pattern. But we could have used:
{tag}
- the name of the snapshot tag, as specified in--snapshot something
{commit}
- the Git commit ID{timestamp}
- Unix timestamp of the time of the release{datetime}
- date and time of the release (14 characters, for example,20211213000730
)
Note: because we are using
{tag}
as placeholder, we can't call--snapshot
with an empty tag name - this will result in error.
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.
What's nice too is I think the tag.datetime syntax matches how Garth did the snapshots for foundations in the spectrum-tokens repo too! Cross-team synchronicity!
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.
@rubencarvalho what do you think about the tag being the PR number or the number is prepended the custom tag?This would make it easier to understand which beta snapshots are associated with PR fixes.
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.
@caseyisonit There's no asset for PR number because there's no guarantee every tag will be connected to a PR but could use the commit.
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.
I also looked into using the commit as a version suffix, but for some reason Changesets decided it should use the full commit hash, which results in a version like: 1.5.0-beta.29d804a8a923bba8c3beaec63fab76b856697b39
.
Maybe we could contribute to Changesets to support a shortCommit option? 😛
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.
LGTM! Thanks for bringing this in!
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
yarn changeset pre enter beta |
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.
When do you activate the beta mode state if you don't do it here? I didn't see this being done elsewhere -- or is it wrapped in a command now?
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.
@rubencarvalho +1 on needing more clarity here
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.
@castastrophe through my pairing with piyush on his other PR I now have a bit more context on this that I'm happy to share.
So essentially Rubens PR is suggesting using snapshot releases as a work around to the beta releases since running beta releases against main is warned against by changesets and we don't use a backup branch.
Warning: If you decide to do prereleases from the main branch of your repository, without having a branch for your last stable release without the prerelease changes, you will block other changes until you are ready to exit prerelease mode. We thoroughly recommend only running prereleases from a branch other than the main branch.
The other issue we were having is that beta releases weren't counting correctly due to leaving prerelease when it is merged. the pre.json doesn't persist so it wont override the latest version in the package.json.
I think this is a good temporary solution for providing releases to consumers to confirm the changes work.
Hopefully this helps make more sense out of what is being suggested.
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.
Hey! This is a great question — I should’ve added a clarifying comment here. There are 3 main reasons:
- We do not keep a living
beta
branch nor do we sync the newly generated beta version back to any other branch for that matter. As a result, when this workflow runs, it always calculates the same first version, e.g.: 1.5.0-beta.0 - By not using the prerelease mode and instead using snapshots, we can generate a unique identifier (timestamp-based), which avoids the issue 1. without the overhead of managing a dedicated branch or modifying our existing workflows (that said, I do think there’s value in exploring a
beta
branch strategy or something along those lines in the future.) - There is a somewhat scary warning on the changesets documentation about using prerelease mode in
main
:

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.
I have made some changes to the beta release process so that we can leverage the current functionality and the version number will also look like this 1.5.0-beta.0 1.5.0-beta.1, 1.5.0-beta.2, and so on..
#5366
Description
This PR updates the beta release workflow to use the snapshot approach for generating unique versions.
We had previously planned to have incremental suffixes for the beta releases (e.g.:
1.5.0-beta.0
,1.5.0-beta.1
, etc.). But this was not working because in CI we do not persist the latest published version, so we would always try to publishbeta.0
. In this PR, we now use a snapshot approach that adds unique timestamps instead (e.g.1.5.0-beta.20250411081626
) ensuring there are no conflicts! :)Motivation and context
The beta release workflow was previously not working correctly after the initial run due to version conflicts (you can see an example run).
The CI environment does not maintain state between runs (it does not know which beta version was last published), so it would always try to publish the same beta version (e.g.,
1.5.0-beta.0
):The workflow now uses
yarn changeset version --snapshot beta
which together with a new changeset config, uses the calculated version and format the version to our desired version output. And by appending a unique timestamp-based suffix, we ensure each CI build creates a distinct version number that won't create conflicts.How has this been tested?
yarn changeset version --snapshot beta
package.json
of any of the components (e.g."version": "1.5.0-beta.20250411081626"
)Types of changes
Checklist
Best practices
This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against
main
.