• Stars
    star
    529
  • Rank 83,787 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Semantic Version Util

svu

Build Status

Semantic Version Util is a tool to manage semantic versions at ease!

You can print the current version, increase patch/minor/major manually or just get the next tag based on your git log!

example usage

svu

Based on the log between the latest tag and HEAD, prints the next tag.

aliases: svu next and svu n

$ svu
v1.3.0

commit messages vs what they do

Commit message Tag increase
fix: fixed something Patch
feat: added new button to do X Minor
fix: fixed thing xyz

BREAKING CHANGE: this will break users because of blah
Major
fix!: fixed something Major
feat!: added blah Major
chore: foo Nothing

svu current

Prints the current tag with no changes.

alias: svu c

Examples:

$ svu current
v1.2.3

$ svu current
v1.2.3-alpha.1+22

svu major

Increases the major of the latest tag and prints it. As per the Semver spec, it'll also clear the pre-release and build identifiers are cleaned up.

Examples:

$ svu current
v1.2.3-alpha.2+123

$ svu major
v2.0.0

$ svu major --pre-release alpha.3 --build 243
v2.0.0-alpha.3+243

svu minor

Increases the minor of the latest tag and prints it. As per the Semver spec, it'll also clear the pre-release and build identifiers are cleaned up.

alias: svu m

Examples:

$ svu current
v1.2.3-alpha.2+123

$ svu minor
v1.3.0

$ svu minor --pre-release alpha.3 --build 243
v1.3.0-alpha.3+243

svu patch

Increases the patch of the latest tag and prints it. As per the Semver spec, if the version has a pre-release or build identifier, they'll be cleaned up and no patch increment will be made. You can force an increment by using --force-patch-increment.

alias: svu p

Examples:

$ svu current
v1.2.3-alpha.2+123

$ svu patch
v1.2.3

$ svu patch --force-patch-increment
v1.2.4

$ svu patch --pre-release alpha.3 --build 243
v1.2.3-alpha.3+243

tag mode

By default svu will get the latest tag from the current branch. Using the --tag-mode flag this behaviour can be altered:

Flag Description Git command used under the hood
--tag-mode current-branch Get latest tag from current branch. git describe --tags --abbrev=0
--tag-mode all-branches Get latest tag across all branches. git describe --tags $(git rev-list --tags --max-count=1)

stripping the tag prefix

--strip-prefix removes any prefix from the version output. For example, v1.2.3 would be output as 1.2.3.

The default prefix is v, however a custom prefix can be supplied using --prefix. So for --prefix=foo/v --strip-prefix and tag foo/v1.2.3, the output would be 1.2.3.

adding a suffix

You can use --pre-release and --build to set the respective Semver identifiers to the resulting version.

force patch version increment

Setting the --force-patch-increment flag forces a patch version increment regardless of the commit message content.

creating tags

The idea is that svu will just print things, so it's safe to run at any time.

You can create tags by wrapping it in an alias. For example, I have one like this:

alias gtn='git tag $(svu next)'

So, whenever I want to create a tag, I just run gtn.

install

Packaging status

macOS

brew install caarlos0/tap/svu

linux

apt

echo 'deb [trusted=yes] https://apt.fury.io/caarlos0/ /' | sudo tee /etc/apt/sources.list.d/caarlos0.list
sudo apt update
sudo apt install svu

yum

echo '[caarlos0]
name=caarlos0
baseurl=https://yum.fury.io/caarlos0/
enabled=1
gpgcheck=0' | sudo tee /etc/yum.repos.d/caarlos0.repo
sudo yum install svu

docker

docker run --rm -v $PWD:/tmp --workdir /tmp ghcr.io/caarlos0/svu --help

Using go install

Make sure that $GOPATH/bin is in your $PATH, because that's where this gets installed:

go install github.com/caarlos0/svu@latest

manually

Or download one from the releases tab and install manually.

stargazers over time

Stargazers over time

More Repositories

1

env

A simple, zero-dependencies library to parse environment variables into structs
Go
4,722
star
2

starcharts

Plot your repository stars over time.
Go
1,016
star
3

dotfiles.zsh

Config files for ZSH, Java, Ruby, Go, Editors, Terminals and more.
Shell
700
star
4

timer

A `sleep` with progress
Go
406
star
5

tasktimer

Task Timer (tt) is a dead simple TUI task timer
Go
398
star
6

dotfiles.fish

my dotfiles
Lua
306
star
7

fork-cleaner

Quickly clean up unused forks on your github account.
Go
261
star
8

domain_exporter

Exports the expiration time of your domains as prometheus metrics.
Go
254
star
9

org-stats

Get the contributor stats summary from all repos of any given organization
Go
180
star
10

dotfiles

โ„๏ธ my configurations for home-manager, nixOS, and nix-darwin
Nix
105
star
11

twitter-cleaner

Automatically delete tweets, retweets, and favorites from your timeline, and, if provided, from your twitter archive as well.
Go
97
star
12

jsonfmt

Like gofmt, but for JSON files.
Go
78
star
13

clone-org

Clone all repos of a github organization
Go
65
star
14

parttysh

something really useful: a party parrot over ssh
Go
58
star
15

httperr

func(w http.ResponseWriter, r *http.Request) error
Go
55
star
16

log

Colorful CLI logger
Go
54
star
17

speedtest-exporter

Exports speedtest-cli metrics in the prometheus format
Go
51
star
18

timea.go

timea.go (did you see what I did there?) is a simple library to print given times in "time ago" manner.
Go
45
star
19

testfs

A simple fs.FS implementation to be used inside tests.
Go
33
star
20

name-generator

quick'n'dirty name generator using docker's namesgenerator pkg
Go
26
star
21

github_releases_exporter

Exports GitHub release metrics to the Prometheus format
Go
24
star
22

version_exporter

Monitor the versions of the things you run and care about
Go
24
star
23

discord-applemusic-rich-presence

Discord's Rich Presence from Apple Music
Go
22
star
24

go-version

Version library extracted from sigs.k8s.io/release-utils
Go
21
star
25

xdg-open-svc

xdg-open as a service
Go
19
star
26

awesome-twitter-communities

A list of awesome twitter communities
19
star
27

go-gumroad

Easily check licenses against Gumroad's API.
Go
19
star
28

karmahub

Compares the amount of issues and pull requests you created with the amount of comments and code reviews you did.
Go
17
star
29

go-sshagent

A simple SSH Agent implementation, written in Go, mainly to be used within tests.
Go
15
star
30

caarlos0

15
star
31

fastcom-exporter

Prometheus Fast.com exporter
Go
15
star
32

promfmt

format prometheus .rules files
Go
13
star
33

goreleaserfiles

my goreleaser.yml files
Go
13
star
34

duration

Copy of stdlib's time.Duration, but ParseDuration accepts other bigger units such as days, weeks, months and years
Go
13
star
35

nur

My Nix User Repository
Nix
13
star
36

sshmarshal

Code copied from x/crypto and golang/go#37132
Go
13
star
37

ctrlc

Go library that provides an easy way of having a task that is context-aware and deals with SIGINT and SIGTERM signals
Go
13
star
38

kube-shutdown-after

Shutdown pods in sandbox clusters when it's not work hours
Go
12
star
39

home

my home k3s cluster
12
star
40

mdtree

Convert markdown lists into ASCII trees
Go
12
star
41

homekit-amt8000

Homekit bridge for Intelbras AMT8000 Alarm Systems
Go
11
star
42

esp8266-garage-door

Homekit controller and firmware for an ESP8266-based automated garage door
Go
8
star
43

uhr

Zeichenorientierte Benutzerschnittstelle Uhr
Go
8
star
44

meta

reusable github actions workflows and other shareable configuration files ๐Ÿซฅ
Go
7
star
45

solarman-exporter

Prometheus Exporter for SolarmanPV
Go
6
star
46

linktree

static linktree with tailwindcss and html
HTML
6
star
47

homekit-shelly

Homekit bridge for Shelly Flood and Smoke sensors
Go
5
star
48

homekit-solarman

Homekit bridge for Solarman Inverters
Go
5
star
49

sinkhole

docker image that just responds any path with 200 and does nothing, for testing
Go
5
star
50

advent-of-code-2022

Advent Of Code 2022 โ€” In Rust, btw
Rust
5
star
51

teatest-example

example teatest app
Go
4
star
52

homebrew-tap

Homebrew Formulae to my binaries, powered by @goreleaser
Ruby
4
star
53

beckeros

Rust
3
star
54

ziglings

learning some zig :P
Zig
3
star
55

go-solarman

Go client for the SolarmanPV API
Go
2
star
56

sync

Simple sync primitives I use here and there, extracted so I can reuse them
Go
2
star
57

transactional

a sqlx transaction wrapper for http.Handler
Go
2
star
58

servers

ansible playbook for my servers
Jinja
2
star
59

.github

github config
1
star
60

dockerfiles

Dockerfile
1
star
61

fish-git-fetch-merge

git fetch && git merge in a breeze
Shell
1
star