git-semver

command module
v0.6.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 2 Imported by: 0

README

git-semver

Build LoC

Git extension to easily manage your project's version based on Semantic Versioning and Conventional Commits

Install

Using Brew
$ brew install carlsberg/tap/git-semver
From source

Requires go >= 1.16.

$ go install github.com/carlsberg/git-semver@latest

Commands

git semver bump

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
git semver latest

Outputs the latest released version.

Example:

$ git semver latest
0.0.1
git semver next

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

Monorepos Support

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`

Usage in GitHub Actions

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 }}

License

This project is released under the MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
internal
git
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL