Git extension to easily manage your project's version based on Semantic Versioning and Conventional Commits
$ brew install carlsberg/tap/git-semver
Requires go >= 1.16
.
$ go install github.com/carlsberg/git-semver@latest
Bumps the latest version to the next version, creates a tag and pushes it to origin
.
Options:
Name | Description |
---|---|
-P, --password |
Password to use in HTTP basic authentication (useful for CI/CD pipelines) |
-u, --username |
Username to use in HTTP basic authentication (useful for CI/CD pipelines) |
-f, --version-file |
Version files that should be updated. Format should be filename:key |
--v-prefix |
Prefix the version with a v |
--skip-tag |
Don't create a new tag automatically |
Example:
$ git commit -am "fix: something important"
$ git semver bump -f package.json:version
bump from 0.0.0 to 0.0.1
Outputs the latest released version.
Example:
$ git semver latest
0.0.1
Outputs the next unreleased version.
Options:
Name | Description |
---|---|
--v-prefix |
Prefix the version with a v |
Example:
$ git commit -am "feat: neat feat"
$ git semver next
0.1.0
Git SemVer supports monorepos with multiple projects through the -p, --project
option. For example, imagine you've a repository with a project in libs/xyz
that you want to version independently:
$ git commit -am "feat: awesome xyz lib"
$ git bump -p libs/xyz -f package.json:version
bump libs/xyz from 0.0.0 to 0.1.0
# creates a tag `libs/xyz/0.1.0`
The following example shows a workflow using git-semver in GitHub Actions:
name: Bump
jobs:
bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: carlsberg/git-semver@v0.5.0
with:
script: |
echo "Latest Version: $(git semver latest)"
echo "Next Version: $(git semver next)"
git semver bump -u ${{ github.actor }} -P ${{ github.token }}
This project is released under the MIT License.