-
Notifications
You must be signed in to change notification settings - Fork 15
Add version bump option to publish workflow #748
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
Introduces a 'version_bump' input to the publish GitHub Actions workflow, allowing selection of patch, minor, or major version increments before prerelease generation. The script now applies the specified version bump to the base version before determining the next available prerelease version.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
.github/workflows/publish.yml
Outdated
| # Apply version bump if requested | ||
| BUMP_TYPE="${{ github.event.inputs.version_bump || 'none' }}" | ||
| if [ "$BUMP_TYPE" != "none" ]; then | ||
| echo "Applying $BUMP_TYPE version bump to $BASE_VERSION" | ||
| # Split version into major.minor.patch | ||
| IFS='.' read -r MAJOR MINOR PATCH <<< "$BASE_VERSION" | ||
| case "$BUMP_TYPE" in | ||
| patch) | ||
| PATCH=$((PATCH + 1)) | ||
| ;; | ||
| minor) | ||
| MINOR=$((MINOR + 1)) | ||
| PATCH=0 | ||
| ;; | ||
| major) | ||
| MAJOR=$((MAJOR + 1)) | ||
| MINOR=0 | ||
| PATCH=0 | ||
| ;; | ||
| esac | ||
| BASE_VERSION="${MAJOR}.${MINOR}.${PATCH}" | ||
| echo "New base version after bump: $BASE_VERSION" | ||
| fi | ||
| # Find the next available prerelease number | ||
| PRERELEASE_NUM=0 | ||
| while true; do | ||
| TEST_VERSION="${BASE_VERSION}-${GITHUB_TAG}.${PRERELEASE_NUM}" | ||
| # Check if this version exists on npm | ||
| if npm view @clickhouse/click-ui@${TEST_VERSION} version 2>/dev/null; then | ||
| echo "Version ${TEST_VERSION} already exists, trying next number..." | ||
| PRERELEASE_NUM=$((PRERELEASE_NUM + 1)) | ||
| else | ||
| # Version doesn't exist, we can use it | ||
| NEW_VERSION="${TEST_VERSION}" | ||
| break | ||
| fi | ||
| # Safety limit to prevent infinite loops | ||
| if [ $PRERELEASE_NUM -gt 100 ]; then | ||
| echo "Error: Too many prerelease versions (>100)" | ||
| exit 1 | ||
| fi | ||
| done | ||
| echo "Generated prerelease version: $NEW_VERSION" | ||
| npm pkg set version=$NEW_VERSION --no-git-tag-version |
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.
can't we just npm version $BUMP_TYPE?
.github/workflows/publish.yml
Outdated
| done | ||
| echo "Generated prerelease version: $NEW_VERSION" | ||
| npm pkg set version=$NEW_VERSION --no-git-tag-version |
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 think NEW_VERSION isn't always defined here
Streamlines the publish.yml workflow by removing the version_bump input, consolidating version/tag handling, and improving prerelease version generation. The workflow now auto-increments patch versions for prereleases, sets npm tags more consistently, and adds cleanup for failed releases. This reduces complexity and improves maintainability for both manual and release-triggered publishing.
Introduces a 'version_bump' input to the publish GitHub Actions workflow, allowing selection of patch, minor, or major version increments before prerelease generation. The script now applies the specified version bump to the base version before determining the next available prerelease version.
There was also an issue with publishing the same beta version on the same version, so added a fix to move the count up so it won't break