-
Notifications
You must be signed in to change notification settings - Fork 222
[HOLD]chore: update changeset-snapshot-publish script to accept a parameter… #5366
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?
Changes from all commits
0b7c148
03992b9
15d5359
ec84db1
b7e5e57
fbac9b2
92511b4
6dba871
a8736cd
65a9534
abcadcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,32 @@ jobs: | |
git config --global user.email "[email protected]" | ||
git config --global user.name "github-actions-bot" | ||
|
||
- name: Get current package version and latest beta number | ||
id: version-info | ||
run: | | ||
# Fetch the latest beta version | ||
LATEST_BETA=$(npm view @spectrum-web-components/bundle --tag beta version || echo "none") | ||
echo "Latest beta: $LATEST_BETA" | ||
|
||
if [[ $LATEST_BETA == *beta* ]]; then | ||
# Extract beta number | ||
BETA_NUMBER=$(echo $LATEST_BETA | grep -oP 'beta\.\K\d+') | ||
# Increment the beta number | ||
NEXT_BETA_NUMBER=$((BETA_NUMBER + 1)) | ||
else | ||
# Start with beta.0 if no beta version exists | ||
NEXT_BETA_NUMBER=0 | ||
fi | ||
|
||
echo "Next beta number: $NEXT_BETA_NUMBER" | ||
echo "next_beta_number=$NEXT_BETA_NUMBER" >> $GITHUB_OUTPUT | ||
|
||
- name: Update package versions for beta release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NEXT_BETA_NUMBER: ${{ steps.version-info.outputs.next_beta_number }} | ||
run: | | ||
yarn changeset pre enter beta | ||
yarn changeset pre enter beta.$NEXT_BETA_NUMBER | ||
# Apply the changeset with specific beta tag | ||
yarn changeset version | ||
yarn lint:versions --fix | ||
|
@@ -43,6 +64,7 @@ jobs: | |
run: | | ||
git add . | ||
git commit -am "chore: publish beta version" | ||
yarn changeset pre exit | ||
yarn prepublishOnly | ||
yarn changeset publish --no-git-tag | ||
yarn changeset publish --no-git-tag --tag beta | ||
git reset --hard HEAD^ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
"build:ts:watch": "wireit", | ||
"build:types": "wireit", | ||
"build:watch": "wireit", | ||
"changeset-snapshot-publish": "yarn prepublishOnly && yarn changeset version --snapshot && yarn lint:versions --fix && yarn update-version && yarn changeset publish --no-git-tag --tag snapshot", | ||
"changeset-snapshot-publish": "yarn prepublishOnly && yarn changeset version --snapshot ${1} && yarn lint:versions --fix && yarn update-version && yarn changeset publish --no-git-tag --tag snapshot", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just as a heads up, this kind of positional parameter does not translate well across operating systems. The most cross-system way to pass variables to commands is via a node script using yargs to read in from the command line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I appreciate your feedback about cross-platform parameter handling. You raise a valid point about positional parameters potentially causing issues across different operating systems.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That all makes great sense! Thanks for outlining some of the background you did to validate this. This is only meant to be run in CI, is that correct? If we have anyone on a unique set-up, can we ask them to validate this locally if there's a chance it might need to be run manually? |
||
"changeset-publish": "yarn prepublishOnly && yarn changeset version && yarn install && yarn lint:versions --fix && yarn update-version && yarn changeset publish --no-git-tag && yarn push-to-remote && yarn create-git-tag && yarn postpublish", | ||
"update-version": "node ./tasks/update-version.js", | ||
"chromatic": "chromatic --build-script-name storybook:build # note that --project-token must be set in your env variables", | ||
|
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 @blunteshwar, I love that you're interested in tackling this workflow for us. I think it'll be a big improvement on how we can communicate some of these not-yet-ready for production releases to our consumers.
I wanted to mention a few things here that could help frame your work.
Lots of possibilities with this tool! Please reach out to me, Cassondra, or Garth if you'd like to talk through this a bit more.
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 is what it looks like in the "run workflow UI"

And this is what it looks like on npm after that workflow completes
