Giter Site home page Giter Site logo

maykonlf / semver-cli Goto Github PK

View Code? Open in Web Editor NEW
73.0 3.0 7.0 105 KB

An easy to use CLI tool to manage your project versions and its upgrades according to the Semantic Versioning specification

License: MIT License

Dockerfile 2.45% Makefile 13.04% Go 81.22% Shell 3.30%
versioning version version-control golang go cli semantic-versioning ci-cd devops-pipeline

semver-cli's Introduction

Semantic Versioning Tool

An easy to use CLI tool to manage your projects current version and its upgrades according to the Semantic Versioning specification.

Getting Started

Install

If you already have golang installed you can install by running the command:

go install github.com/maykonlf/semver-cli/cmd/semver@latest

check install

Check if the semver was instaled running the command:

semver 

Init semver

To start managing your project versions enter into the project folder, then run:

semver init

This command will start the versioning based on release version v1.0.0. If you want to start with another version number you car run instead:

semver init  \
    --release [base release version] \
    [ --alpha [curent alpha number] ] \
    [ --beta [current beta number] ] \
    [ --rc [current release candiate number] ] \
    [--force] # to override an already initialized semver in the current directory.

Usage

Get current version

Alpha

Returns the current alpha version (if none will return and "-alpha.0" version).

$ semver get alpha
v1.0.0-alpha.6

Beta

Returns the current beta version (if none will return and "-beta.0" version).

$ semver get beta
v1.0.0-beta.3

Release Candidate

Returns the current release candidate version (if none will return and "-rc.0" version).

$ semver get rc
v1.0.0-rc.1

Release

Returns the current release version.

$ semver get release
v1.0.0

Upgrade version

Alpha

Increment the current alpha version by 1. If none starts with 1.

$ semver up alpha
v1.0.0-alpha.7

Beta

Increment the current beta version by 1. If none starts with 1.

$ semver up beta
v1.0.0-beta.4

Release Candidate

Increment the current release candidate version by 1. If none starts with 1.

$ semver up rc
v1.0.0-rc.2

Release

Upgrade an alpha, beta or rc to its final release version. Also increments the patch number by 1 to a release version:

$ semver up release
v1.0.0

$ semver up release
v1.0.1

Minor

Increments release minor version number by 1 (useful when you start working on next release version) and clear alpha, beta, rc and patch number.

$ semver up minor
v1.1.0

Before you upgrade the minor version the next versions will be generated based on this new minor version.

$ semver up alpha
v1.1.0-alpha.1

$ semver up beta
v1.1.0-beta.1

$ semver up rc
v1.1.0-rc.1

Major

Upgrades the current version to the next major version (when you starts working on a new version with branking changes) and clear alpha, beta, rc, patch and minor number.

$ semver up major
v2.0.0

Before them, your next versions will be generated based on this new version.

$ semver up alpha
v2.0.0-alpha.1

$ semver up beta
v2.0.0-beta.1

$ semver up rc
v2.0.0-rc.1

semver-cli's People

Contributors

adlandh avatar dependabot[bot] avatar maykonlf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

semver-cli's Issues

not possible to build with go-1.18

go install github.com/maykonlf/semver-cli/cmd/semver@latest
go: downloading github.com/maykonlf/semver-cli v1.0.2
go: downloading github.com/spf13/cobra v0.0.5
go: downloading github.com/spf13/viper v1.6.1
go: downloading github.com/fsnotify/fsnotify v1.4.7
go: downloading github.com/hashicorp/hcl v1.0.0
go: downloading github.com/magiconair/properties v1.8.1
go: downloading github.com/pelletier/go-toml v1.6.0
go: downloading github.com/spf13/cast v1.3.0
go: downloading github.com/spf13/jwalterweatherman v1.1.0
go: downloading github.com/subosito/gotenv v1.2.0
go: downloading gopkg.in/ini.v1 v1.51.0
go: downloading gopkg.in/yaml.v2 v2.2.7
go: downloading golang.org/x/text v0.3.2
go: downloading golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9

golang.org/x/sys/unix

Users/adlan/Devel/go/pkg/mod/golang.org/x/[email protected]/unix/syscall_darwin.1_13.go:25:3: //go:linkname must refer to declared function or variable
Users/adlan/Devel/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:27:3: //go:linkname must refer to declared function or variable
Users/adlan/Devel/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:40:3: //go:linkname must refer to declared function or variable
Users/adlan/Devel/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:28:3: //go:linkname must refer to declared function or variable
Users/adlan/Devel/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:43:3: //go:linkname must refer to declared function or variable
Users/adlan/Devel/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:59:3: //go:linkname must refer to declared function or variable
Users/adlan/Devel/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:75:3: //go:linkname must refer to declared function or variable
Users/adlan/Devel/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:90:3: //go:linkname must refer to declared function or variable
Users/adlan/Devel/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:105:3: //go:linkname must refer to declared function or variable
Users/adlan/Devel/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:121:3: //go:linkname must refer to declared function or variable
Users/adlan/Devel/go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.go:121:3: too many errors

With go-1.17 eveything's ok

semver init --force should not error if the .semver.yaml file isn't there.

The --force option should work regardless of whether semver has been run previously:

❯ rm .semver.yaml

~
❯ semver init --force --release 1.2.3
Error: Config File ".semver" Not Found in "[/Users/stewartbryson]"
Usage:
  semver init [flags]

Examples:
semver init [--release v0.1.0] [--rc 1] [--beta 2] [--alpha 3] [--force]

Flags:
      --alpha int         current alpha version number
      --beta int          current beta version number
      --force             force recreate config file
  -h, --help              help for init
      --rc int            current rc version number
      --release version   release version (default v0.0.0-.0)

Config File ".semver" Not Found in "[/Users/stewartbryson]"

~
❯

semver init v1.0.0-beta.23

$ semver init v1.0.0-beta.23
$ cat .semver.yaml            
alpha: 0
beta: 0
rc: 0
release: v1.0.0

I think that beta is not taken into account

Add License

Hello @maykonlf
Thanks a lot for the tool.
Please, would you mind to add a license to the project?
I'm thinking in using this tool but I would like to know which license does it have 😊
Thanks. Regards,

semver up patch?

vx.x.(x) <- patch

Could be semver up patch or even shorter semver patch

ARM zip contains x86-64 version

❯ # the machine I am on
❯ uname -a
Darwin mymac 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64
❯ unzip semver-macos-arm64.zip
Archive:  semver-macos-arm64.zip
  inflating: semver
❯ ./semver
zsh: exec format error: ./semver
❯ file semver
semver: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=mB-Q2DrTfOLqwwkfLMON/oYB7gncRpRsfj5lCcWa5/e8IRuQZpScLrdQvGOERm/Jue8DTiRHjq5MBKjJ_sR, not stripped

The ARM zip content is the same as the AMD zip...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.