Repository navigation
feat: add automatic package.json version bump based on GitHub releases - #19
Merged
Merged
Conversation
- Added automatic package.json version bump to the publish extension workflow. It gets the release tag, validates that it's the correct format, removes any prerelease tags it may have (because vscode doesn't like prerelease tags in the extension versions), bump the version in package.json and package.lock with the version from the release tag, commits the changes, force pushes the tag reference to point to the new commit, and then publish the extension to the marketplaces.
- Added a new workflow step to create a new branch that the package.json version bump will be committed to. The branch will be named in the form of "release/[version]". - Refactored the Commit Changes step to include error handling and push the new branch to remote. - Added a new workflow step to create a new PR from the newly created branch. It uses the GitHub's (gh) CLI commands to create the PR and merge it automatically onto the default branch (master) via the auto-merge strategy. By committing the version bump to a branch and using a PR to merge the changes onto the master branch, we prevent code being committed straight to master. And by using GitHub's auto-merge strategy, we ensure that the commits and PRs adhere to branch protection rules, if there are any. A new step after the creation will wait for any PR checks to be completed and the PR to be merged. It checks the state of the PR using gh commands to ensure the PR is merged. If the PR is merged within the allotted time (around 5 mins), the step succeeds and continues to the next, otherwise it will error out. - Refactored the Update Tag References step to pull the latest changes from the branch to ensure it is using the up to date commit. - Added new step to echo a success message after the extension was published to both marketplaces.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request significantly enhances the release automation workflow for the VS Code extension by introducing a robust, multi-stage process for validating release versions, updating the
package.jsonversion, and ensuring that version bumps are properly committed and merged before publishing. The workflow now automatically creates pull requests for version updates, waits for merges, and updates tags accordingly, improving reliability and reducing manual intervention.Key improvements and additions:
Automated Version Validation and Update:
validate-release-versionjob to parse and validate the release tag against semver, ensuring only valid versions proceed.update-versionjob that updatespackage.jsonandpackage-lock.jsonwith the new version, creates a dedicated release branch, commits changes, opens a pull request, and waits for it to be merged before proceeding.Branch and Pull Request Management:
gh) to open a pull request, apply labels, enable auto-merge, and wait for the merge to complete before continuing.Tag Management:
Deployment Improvements:
deployjob) checks out the correct branch (TARGET_BRANCH) and usesnpm cifor consistent dependency installation.Workflow Permissions and Environment: