Code Monkey home page Code Monkey logo

semver-cli's Introduction

semver-cli

Build Status Go Report Card

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

It is basically a cli wrapper around the excellent Masterminds semver library, with lots of help from the also excellent Kingpin

usage: semver [<flags>] <command> [<args> ...]

Command-line semver tools. On error, print to stderr and exit -1.

Flags:
      --help     Show context-sensitive help (also try --help-long and --help-man).
  -v, --verbose  Verbose mode.

Commands:
  help [<command>...]
    Show help.

  satisfies <VERSION> <CONSTRAINTS>
    Test if a version satisfies a constraint. Exit 0 if satisfies, 1 if not. If verbose, print an explanation to stdout.

  greater <A> <B>
    Compare two versions. Exit 0 if the first is greater, 1 if not. If verbose, print greater to stdout.

  lesser <A> <B>
    Compare two versions. Exit 0 if the first is lesser, 1 if not. If verbose, print lesser to stdout.

  equal <A> <B>
    Compare two versions. Exit 0 if they are equal, 1 if not.

  inc <COMPONENT> <VERSION>
    Increment major, minor, or patch component.

  get <COMPONENT> <VERSION>
    Get major, minor, patch, prerelease or metadata component.

  set <COMPONENT> <VERSION> <VALUE>
    Set prerelease or metadata component.

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 fmeyer avatar soupdiver 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.