From 08e870b84d7a29273b53745b269bbff68d39eaa9 Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Thu, 8 Apr 2021 19:43:14 +0200 Subject: [PATCH 01/10] develop prefix option --- README.md | 25 +++++++++++++------------ setver.sh | 8 ++++++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e2653b8..57f9ace 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,19 @@ to bump the version changelog: add chapter with latest changes to CHANGELOG.md ``` +## Example: + + > setver new patch + ✔ version 1.12.0 -> 1.12.1 + ✔ set version in package.json + ✔ set version in composer.json + ✔ set version in .env.example + ✔ set version in VERSION.md + ✔ commit and push changed files + ✔ push tags to git@github.com:pforret/setver.git + ✔ to create a release, go to https://github.com/pforret/setver + + ## Installation with [basher](https://github.com/basherpm/basher) @@ -60,18 +73,6 @@ or the hard way # if you want the script to be in your path ln -s /setver /usr/local/bin/ -## Example: - - > setver new patch - ✔ version 1.12.0 -> 1.12.1 - ✔ set version in package.json - ✔ set version in composer.json - ✔ set version in .env.example - ✔ set version in VERSION.md - ✔ commit and push changed files - ✔ push tags to git@github.com:pforret/setver.git - ✔ to create a release, go to https://github.com/pforret/setver - ## References * https://semver.org/ diff --git a/setver.sh b/setver.sh index cd47e87..d416ece 100755 --- a/setver.sh +++ b/setver.sh @@ -35,11 +35,13 @@ env_example=".env.example" verbose=0 check_in_root=1 usage=0 -while getopts rvh option ; do +prefix="v" +while getopts rvhp: option ; do case $option in r) check_in_root=0 ;; v) verbose=1 ;; h) usage=1 ;; + p) prefix="$OPTARG" ;; *) echo "Unknown option -$option" esac done @@ -152,6 +154,7 @@ show_usage_and_quit() { $script_fname [-h] [-v] [-s] [get/check/push/auto/skip/set/new/history/changelog] [version] -h: extended help -v: verbose mode (more output to stderr) + -p : use as prefix for git tag (default: "v") -s: add [skip_ci] flag to get : get current version (from git tag and composer) -- can be used in scripts check : compare versions of git tag and composer @@ -205,6 +208,7 @@ get_version_tag() { if [[ -n $(git tag) ]] ; then git tag \ | sed 's/v//' \ + | sed "s/$prefix//" \ | awk -F. '{printf("%04d.%04d.%04d\n",$1,$2,$3);}' \ | sort \ | tail -1 \ @@ -477,7 +481,7 @@ set_versions() { if [[ $skip_git_tag == 0 ]]; then success "set git version tag" wait 1 - git tag "v$new_version" + git tag "$prefix$new_version" fi # also push tags to github/bitbucket From 150f990841b8dce1035dc5517c11428d624b22c9 Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Thu, 8 Apr 2021 19:44:17 +0200 Subject: [PATCH 02/10] 1.14.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 490bd5a..9f41348 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setver", - "version": "1.14.0", + "version": "1.14.1", "description": "Semantic Versioning helper script for composer.json, package.json, git tag and VERSION.md -- works with Github/Bitbucket/Packagist", "main": "setver.sh", "scripts": { From 1c3e4f4b6ca9ade3a8a7af1b70b93bb665bcb294 Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Thu, 8 Apr 2021 19:44:21 +0200 Subject: [PATCH 03/10] setver: set version to 1.14.1 [skip ci] --- .env.example | 2 +- VERSION.md | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index aeb6997..88350b3 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ APP_NAME=pforret/semver APP_DEBUG=true -APP_VERSION=1.14.0 +APP_VERSION=1.14.1 diff --git a/VERSION.md b/VERSION.md index 850e742..63e799c 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -1.14.0 +1.14.1 diff --git a/composer.json b/composer.json index c5a10bb..06501d4 100644 --- a/composer.json +++ b/composer.json @@ -9,5 +9,5 @@ } ], "require": {}, - "version": "1.14.0" + "version": "1.14.1" } From 80290a9364881334bfb72b839fbd05c03b579380 Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Thu, 8 Apr 2021 19:45:04 +0200 Subject: [PATCH 04/10] 1.14.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9f41348..082fb11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setver", - "version": "1.14.1", + "version": "1.14.2", "description": "Semantic Versioning helper script for composer.json, package.json, git tag and VERSION.md -- works with Github/Bitbucket/Packagist", "main": "setver.sh", "scripts": { From ff8ef7f2c8f6fdec1571a5c0a58f4abb56000f0b Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Thu, 8 Apr 2021 19:45:09 +0200 Subject: [PATCH 05/10] setver: set version to 1.14.2 [skip ci] --- .env.example | 2 +- VERSION.md | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 88350b3..2f4b0fc 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ APP_NAME=pforret/semver APP_DEBUG=true -APP_VERSION=1.14.1 +APP_VERSION=1.14.2 diff --git a/VERSION.md b/VERSION.md index 63e799c..a4cc557 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -1.14.1 +1.14.2 diff --git a/composer.json b/composer.json index 06501d4..d06d77e 100644 --- a/composer.json +++ b/composer.json @@ -9,5 +9,5 @@ } ], "require": {}, - "version": "1.14.1" + "version": "1.14.2" } From 75547bec91f23e00bcbaef134b395a355ae56190 Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Thu, 8 Apr 2021 19:45:41 +0200 Subject: [PATCH 06/10] 1.14.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 082fb11..fef5da1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setver", - "version": "1.14.2", + "version": "1.14.3", "description": "Semantic Versioning helper script for composer.json, package.json, git tag and VERSION.md -- works with Github/Bitbucket/Packagist", "main": "setver.sh", "scripts": { From a3656f626fededa406a72e20a692ab9cbb24fcc7 Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Thu, 8 Apr 2021 19:45:46 +0200 Subject: [PATCH 07/10] setver: set version to 1.14.3 [skip ci] --- .env.example | 2 +- VERSION.md | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 2f4b0fc..4c4ac06 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ APP_NAME=pforret/semver APP_DEBUG=true -APP_VERSION=1.14.2 +APP_VERSION=1.14.3 diff --git a/VERSION.md b/VERSION.md index a4cc557..4ea8ad8 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -1.14.2 +1.14.3 diff --git a/composer.json b/composer.json index d06d77e..24bc8a8 100644 --- a/composer.json +++ b/composer.json @@ -9,5 +9,5 @@ } ], "require": {}, - "version": "1.14.2" + "version": "1.14.3" } From ab02bc0307998c0c7e31eba16042298b54b14cd5 Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Thu, 8 Apr 2021 19:48:06 +0200 Subject: [PATCH 08/10] show versions --- setver.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setver.sh b/setver.sh index d416ece..441817c 100755 --- a/setver.sh +++ b/setver.sh @@ -415,7 +415,7 @@ set_versions() { if [[ $uses_npm -gt 0 ]]; then # for NPM/node repos # first change package.json - success "set version in package.json" + success "set version in package.json: $new_version" wait 1 npm version "$new_version" skip_git_tag=1 # npm also creates the tag @@ -427,7 +427,7 @@ set_versions() { if [[ $uses_composer -gt 0 ]]; then # for PHP repos # first change composer.json - success "set version in composer.json" + success "set version in composer.json: $new_version" wait 1 composer config version "$new_version" 2> /dev/null @@ -438,7 +438,7 @@ set_versions() { ### .env if [[ $uses_env -gt 0 ]]; then # for Ruby/PHP/bash/... - success "set version in $env_example" + success "set version in $env_example: $new_version" wait 1 env_temp="$env_example.tmp" awk -F= -v version="$new_version" ' @@ -464,7 +464,7 @@ set_versions() { ### VERSION.md if [[ -f VERSION.md ]]; then # for bash repos - success "set version in VERSION.md" + success "set version in VERSION.md: $new_version" wait 1 echo "$new_version" >VERSION.md git add VERSION.md @@ -479,7 +479,7 @@ set_versions() { # now create new version tag if [[ $skip_git_tag == 0 ]]; then - success "set git version tag" + success "set git version tag: $prefix$new_version" wait 1 git tag "$prefix$new_version" fi From 35c082e66ba18d7e8d215429c41099b1575f1133 Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Thu, 8 Apr 2021 19:48:33 +0200 Subject: [PATCH 09/10] 1.14.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fef5da1..ef3a169 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "setver", - "version": "1.14.3", + "version": "1.14.4", "description": "Semantic Versioning helper script for composer.json, package.json, git tag and VERSION.md -- works with Github/Bitbucket/Packagist", "main": "setver.sh", "scripts": { From 142db0294a6e2ad6775fe63d7abe34d73eee67de Mon Sep 17 00:00:00 2001 From: Peter Forret Date: Thu, 8 Apr 2021 19:48:38 +0200 Subject: [PATCH 10/10] setver: set version to 1.14.4 [skip ci] --- .env.example | 2 +- VERSION.md | 2 +- composer.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 4c4ac06..40a58a0 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,3 @@ APP_NAME=pforret/semver APP_DEBUG=true -APP_VERSION=1.14.3 +APP_VERSION=1.14.4 diff --git a/VERSION.md b/VERSION.md index 4ea8ad8..4e00d0a 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -1.14.3 +1.14.4 diff --git a/composer.json b/composer.json index 24bc8a8..aff6174 100644 --- a/composer.json +++ b/composer.json @@ -9,5 +9,5 @@ } ], "require": {}, - "version": "1.14.3" + "version": "1.14.4" }