Skip to content
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

Introduce version increment validation #50

Merged
merged 9 commits into from
Nov 8, 2024

Conversation

owanturist
Copy link
Collaborator

It modifies the GH workflows to verify that a PR does not include unwanted changesets based on the baseBranch field in the .changeset/config.json file:

  1. Only patch changesets are allowed for v[0-9]+.x.x branches
  2. Only path and minor changesets are allowed for v[0-9]+.[0-9]+.x branches
  3. All changesets are allowed for any other branches

Examples:

  1. The branch v1.0.x must stay within patch range and should never release 1.1.0 version because that version might be already released before or will be released from more appropriate commit.
  2. The branch v10.x.x must stay within minor range and should never release v11.0.0 version.

Copy link

changeset-bot bot commented Nov 8, 2024

⚠️ No Changeset found

Latest commit: c3a4ec8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -4,6 +4,7 @@ on:
pull_request:
paths-ignore:
- "**.md"
- "!.changeset/**"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not ignore changesets!

if [ ! -s "$OUTPUT" ]; then
echo "Error: Temporary file is empty after running 'yarn changeset status'"
exit 1
fi
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that part has been extracted to .github/actions/changeset-status/action.yml for convenient use in both checks and build jobs


# creates a PR if there are changesets or assign the new tag if the PR is merged
- name: Create Release Pull Request or Publish
id: changesets
if: steps.release-details.outputs.message
# runs only when the changeset's base_branch is the target branch
if: steps.changeset-status.outputs.base_branch == '${{ github.ref_name }}'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved from the removed Determine Release Details step

owanturist pushed a commit that referenced this pull request Nov 8, 2024
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
owanturist added a commit that referenced this pull request Nov 8, 2024
* Verify the version bump against the base branch (#45)

* Add patch (#49)

* Add second patch

* 🚀 Release `[email protected] → 0.2.2` (#50)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Add patch

* 🚀 Release `[email protected] → 0.2.30` (#51)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Use publihsedPackages for tagged_release

* Reset source changes

* Add comments about fetch-depth: 0

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@owanturist owanturist merged commit c23164d into v0.2.x Nov 8, 2024
3 checks passed
@owanturist owanturist deleted the introduce-version-increment-validation branch November 8, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants