semver
offers a streamlined command-line experience to implement semantic versioning for your projects seamlessly. Whether you utilize git tags or prefer a .version
file for non-git projects, semver
has got you covered.
- Standard version format:
MAJOR.MINOR.PATCH
(e.g.,1.0.0
) - Supports pre-release versions with
MAJOR.MINOR.PATCH-PRERELEASE
format (e.g.,1.0.0-alpha.1
)
Linux:
VERSION="1.2.2" && \
TMP_FILE="/tmp/semver_$VERSION_linux_amd64.tar.gz" && \
curl -sLo $TMP_FILE https://github.com/adharshmk96/semver/releases/download/v$VERSION/semver_$VERSION_linux_amd64.tar.gz && \
sudo tar xz -C /usr/local/bin -f $TMP_FILE semver && \
rm $TMP_FILE
- Download from the releases page.
- Decompress and Move binary to
/usr/local/bin
or any directory in yourPATH
.
go install github.com/adharshmk96/semver@latest
Note: Ensure Golang is properly set up and that GOPATH
is configured in your PATH.
Start a new project with the following, optionally specifying the version:
semver init # Default initialization
semver init v1.0.0 # With v1.0.0 version
Note: Initialization is unnecessary if you're already using git tags for versioning.
semver get
Easily increment version numbers:
semver major # v1.0.0 -> v2.0.0
semver minor # v1.0.0 -> v1.1.0
semver patch # v1.0.0 -> v1.0.1
For pre-releases, append the desired flag:
semver major --alpha # v1.0.0 -> v2.0.0-alpha.1
semver minor --beta # v1.0.0 -> v1.1.0-beta.1
semver patch --rc # v1.0.0 -> v1.0.1-rc.1
Manage pre-release versions effortlessly:
semver alpha # v1.0.0-alpha.1 -> v1.0.0-alpha.2
semver beta # v1.0.0-beta.1 -> v1.0.0-beta.2
semver rc # v1.0.0-rc.1 -> v1.0.0-rc.2
Tip: use --push
or -p
flag to push the latest tag to remote repository along with version update command.
Note: Direct pre-release updates on a release version will fail. First, create a pre-release as shown above.
Strip pre-release tags:
semver release # v1.0.0-alpha.2 -> v1.0.0
remove latest tag:
semver untag
remove specific tag:
semver untag v1.0.0
add --remote
flag to remove remote tag as well.
semver push
Pushes latest tag to remote repository. git push origin <current tag>
is executed under the hood.
Easily revert to a specified version or default to v0.0.1
:
Local:
semver reset # v1.2.3 -> v0.0.1
semver reset v1.0.0 # v1.2.3 -> v1.0.0
Remote:
semver reset --remote # v1.2.3 -> v0.0.1
semver reset v1.0.0 --remote # v1.2.3 -> v1.0.0
reset
to avoid unintended data loss.
Licensed under the MIT License.
For any support, queries, or feedback, feel free to reach out at [email protected].