Git Product home page Git Product logo

semver-cli's Introduction

semver

semver is a simple command line tool to compare and manipulate version strings

Note that this fork is under heavy redevelopment and should be treated as a moving target until there is a stable release

It is basically a Kong CLI wrapper around the excellent Masterminds semver library.

$ semver --help
Usage: semver <command>

command-line semantic versioning tools

Commands:
  satisfies (sat)    test if a version satisfies given constraints
  greater (gt)       compare two versions, successful if the first is greater
  lesser (lt)        compare two versions, successful if the second is greater
  equal (eq)         compare two versions, successful if they are equal
  increment (inc)    increment major, minor, or patch component
  get                get major, minor, or patch component
  set                set prerelease or metadata component
  latest (lat)       list latest version from a list of versions

Flags:
  -h, --help       Show context-sensitive help.
  -V, --verbose    enable verbose output
  -v, --version    display version information and exit

Run "semver <command> --help" for more information on a command.

Example

Deploy only when the CI tag is within constraints and is greater than what is currently released. For example, with constraints 1.* and a released version of 1.4, a version of 1.5 would be released but a version of 2.0 or 1.2 would not.

#!/bin/bash

CONSTRAINTS=$(jq .labels.constraints manifest.json)
RELEASED=$(jq .image manifest.json | cut -d: -f 2)

semver satisfies "$CI_TAG" "$CONSTRAINTS" || exit 1
semver greater   "$CI_TAG" "$RELEASED"    || exit 1

deploy

semver-cli's People

Contributors

benjamintf1 avatar bradylove avatar davidrjonas avatar mckern avatar

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.