-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLEASE NOTE these changes are NOT releasing rather providing scripts so that they can be used to help the process You shouldn't need to manually update version numbers. Change-Id: I6a4e60ba79c5dd67081070f59fa27a2c94190031 Signed-off-by: Matthew B. White <whitemat@uk.ibm.com>
- Loading branch information
Showing
5 changed files
with
194 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
# Exit on first error, print all commands. | ||
set -e | ||
set -o pipefail | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" | ||
|
||
# set to echo to do processing but not the git commands | ||
#DRYRUN=echo | ||
|
||
# release name | ||
RELEASE=release-1.4 | ||
|
||
function abort { | ||
echo "!! Exiting shell script" | ||
echo "!!" "$1" | ||
exit -1 | ||
} | ||
|
||
VERSION=$(jq '.version' ${DIR}/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]).*/\1/") | ||
|
||
echo New version string will be v${VERSION} | ||
|
||
# do the release notes for this new version exist? | ||
if [[ -f "${DIR}/release_notes/v${VERSION}.txt" ]]; then | ||
echo "Release notes exist, hope they make sense!" | ||
else | ||
abort "No releases notes under the file ${DIR}/release_notes/v${NEW_VERSION}.txt exist"; | ||
fi | ||
|
||
|
||
|
||
|
||
${DRYRUN} git checkout "${RELEASE}" | ||
${DRYRUN} git pull | ||
${DRYRUN} git tag -a "v${VERSION}" `git log -n 1 --pretty=oneline | head -c7` -F release_notes/"v${VERSION}".txt | ||
${DRYRUN} git push origin v${VERSION} HEAD:refs/heads/${RELEASE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/bin/bash | ||
# Release process for the Java chaincode is this | ||
# | ||
# > Work from the latest release-1.4 branch | ||
# > Write a new release notes file along the lines of the the existing files | ||
# > Run the script | ||
# | ||
# ./scripts/release.sh | ||
# | ||
# This will change the version to the correct release version and set the tag to mark the package | ||
# as npm publishable by the merge builds | ||
# > Submit this to gerrit with this push command | ||
# | ||
# git push origin HEAD:refs/for/release-1.4 | ||
# | ||
# > When the build has complete, git pull to update your branch | ||
# > To tag in gerrit run | ||
# | ||
# ./scripts/gittag.sh | ||
# | ||
# > To update the version to a new snapshot leve run the | ||
# | ||
# NEW_SUFFIX=snapshot ./scripts/release.sh | ||
# | ||
# > Push these changes as per normal | ||
|
||
|
||
# Exit on first error, print all commands. | ||
set -e | ||
set -o pipefail | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" | ||
|
||
function abort { | ||
echo "!! Exiting shell script" | ||
echo "!!" "$1" | ||
exit -1 | ||
} | ||
|
||
# need determine the release version | ||
# Suffix can be added after the version eg rc or beta etc. | ||
if [ -z ${NEW_SUFFIX+x} ]; then | ||
echo Suffix is not specified using pure version number | ||
NEW_VERSION=$(jq '.version' ${DIR}/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9])-.*/\1/") | ||
NEW_TAG="latest" | ||
elif [[ ${NEW_SUFFIX} == 'snapshot' ]]; then | ||
echo new suffix is ${NEW_SUFFIX} | ||
CURRENT_VERSION=$(jq '.version' ${DIR}/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9])(.)*/\1/") | ||
NEW_VERSION=$( ${DIR}/node_modules/.bin/semver -i ${CURRENT_VERSION} )-snapshot | ||
NEW_TAG="unstable-1.4" | ||
else # for beta, rc etc releases where the version doesn't change | ||
echo new suffix is ${NEW_SUFFIX} | ||
NEW_VERSION=$(jq '.version' ${DIR}/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9])(.)*/\1-${NEW_SUFFIX}/") | ||
NEW_TAG="${NEW_SUFFIX}-1.4" | ||
fi | ||
|
||
echo New version string will be "${NEW_VERSION}" | ||
|
||
# do the release notes and changelog for this new version exist if needed | ||
if [[ ${NEW_TAG} == 'latest' ]]; then | ||
if [[ -f "${DIR}/release_notes/v${NEW_VERSION}.txt" ]]; then | ||
echo "Release notes exist, hope they make sense!" | ||
else | ||
abort "No releases notes under the file ${DIR}/release_notes/v${NEW_VERSION}.txt exist"; | ||
fi | ||
|
||
OLD_VERSION=$(cat ./CHANGELOG.md | sed -n 1p | sed -n -e "s/.*v\(.*\)/\1/p") | ||
echo Previous version is v${OLD_VERSION} | ||
|
||
echo "Writing change log..." | ||
"${DIR}/scripts/changelog.sh" "v${OLD_VERSION}" "v${NEW_VERSION}" | ||
echo "...done" | ||
fi | ||
|
||
# need to modify the package.json versions now to represent the updates | ||
for PACKAGE in fabric-shim-crypto fabric-shim fabric-contract-api | ||
do | ||
jq --arg VERSION "${NEW_VERSION}" --arg TAG "${NEW_TAG}" '.version = $VERSION | .tag = $TAG ' ${DIR}/${PACKAGE}/package.json > ".tmp" && mv ".tmp" ${DIR}/${PACKAGE}/package.json | ||
done | ||
|
||
jq --arg VERSION "${NEW_VERSION}" '.version = $VERSION' ${DIR}/package.json > ".tmp" && mv ".tmp" ${DIR}/package.json | ||
# This is a optional operation that can be done at any point to update the | ||
# test to use a specific version of Fabric docker images etc | ||
# | ||
|
||
if [[ ${NEW_TAG} == 'latest' ]]; then | ||
echo "Please verify that all is well with the changes, add, comit and push to gerrit with" | ||
echo "" | ||
echo "git push origin HEAD:refs/for/release-1.4" | ||
echo "" | ||
echo "Wait for build to happen, which will push NPM modules, then run ./scripts/gittag.sh" | ||
else | ||
echo "Please verify that all is well with the changes, and, commit and push to gerrit as normal" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
{ | ||
"name": "ts_chaincode", | ||
"description": "Chaincode testing typescript functionality and annotations", | ||
"engines": { | ||
"node": ">=8.4.0", | ||
"npm": ">=5.3.0" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"start": "fabric-chaincode-node start", | ||
"prestart": "tsc" | ||
}, | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"engine-strict": true, | ||
"engineStrict": true, | ||
"version": "1.0.0", | ||
"author": "", | ||
"license": "APACHE-2.0", | ||
"dependencies": { | ||
"fabric-shim": "unstable", | ||
"fabric-contract-api": "unstable", | ||
"@types/node": "^10.3.6", | ||
"ts-node": "^3.3.0", | ||
"tslint": "^5.6.0", | ||
"typescript": "^2.5.3" | ||
} | ||
"name": "ts_chaincode", | ||
"description": "Chaincode testing typescript functionality and annotations", | ||
"engines": { | ||
"node": ">=8.4.0", | ||
"npm": ">=5.3.0" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"start": "fabric-chaincode-node start", | ||
"prestart": "tsc" | ||
}, | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"engine-strict": true, | ||
"engineStrict": true, | ||
"version": "1.0.0", | ||
"author": "", | ||
"license": "APACHE-2.0", | ||
"dependencies": { | ||
"fabric-shim": "unstable", | ||
"fabric-contract-api": "unstable", | ||
"@types/node": "^10.3.6", | ||
"ts-node": "^3.3.0", | ||
"tslint": "^5.6.0", | ||
"typescript": "^2.5.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
{ | ||
"name": "chaincode", | ||
"description": "Chaincode testing crud functionality", | ||
"engines": { | ||
"node": ">=8.4.0", | ||
"npm": ">=5.3.0" | ||
}, | ||
"scripts": { | ||
"start": "fabric-chaincode-node start" | ||
}, | ||
"main": "index.js", | ||
"engine-strict": true, | ||
"engineStrict": true, | ||
"version": "1.0.0", | ||
"author": "", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"fabric-shim": "unstable", | ||
"fabric-contract-api": "unstable" | ||
} | ||
"name": "chaincode", | ||
"description": "Chaincode testing crud functionality", | ||
"engines": { | ||
"node": ">=8.4.0", | ||
"npm": ">=5.3.0" | ||
}, | ||
"scripts": { | ||
"start": "fabric-chaincode-node start" | ||
}, | ||
"main": "index.js", | ||
"engine-strict": true, | ||
"engineStrict": true, | ||
"version": "1.0.0", | ||
"author": "", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"fabric-shim": "unstable", | ||
"fabric-contract-api": "unstable" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
{ | ||
"name": "chaincode", | ||
"description": "Chaincode testing query functionality", | ||
"engines": { | ||
"node": ">=8.4.0", | ||
"npm": ">=5.3.0" | ||
}, | ||
"scripts": { | ||
"start": "fabric-chaincode-node start" | ||
}, | ||
"main": "index.js", | ||
"engine-strict": true, | ||
"engineStrict": true, | ||
"version": "1.0.0", | ||
"author": "", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"fabric-shim": "unstable", | ||
"fabric-contract-api": "unstable" | ||
} | ||
"name": "chaincode", | ||
"description": "Chaincode testing query functionality", | ||
"engines": { | ||
"node": ">=8.4.0", | ||
"npm": ">=5.3.0" | ||
}, | ||
"scripts": { | ||
"start": "fabric-chaincode-node start" | ||
}, | ||
"main": "index.js", | ||
"engine-strict": true, | ||
"engineStrict": true, | ||
"version": "1.0.0", | ||
"author": "", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"fabric-shim": "unstable", | ||
"fabric-contract-api": "unstable" | ||
} | ||
} |