mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
Added a script to increase the version (#850)
* added script to update the bor version across all the locations * minor update
This commit is contained in:
parent
f8032dba23
commit
1e181a9b2e
1 changed files with 81 additions and 0 deletions
81
scripts/updateVersion.sh
Executable file
81
scripts/updateVersion.sh
Executable file
|
|
@ -0,0 +1,81 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
echo "The version is of form - VersionMajor.VersionMinor.VersionPatch-VersionMeta"
|
||||
echo "Let's take 0.3.4-beta as an example. Here:"
|
||||
echo "* VersionMajor is - 0"
|
||||
echo "* VersionMinor is - 3"
|
||||
echo "* VersionPatch is - 4"
|
||||
echo "* VersionMeta is - beta"
|
||||
echo ""
|
||||
echo "Now, enter the new version step-by-step below:"
|
||||
|
||||
version=""
|
||||
|
||||
# VersionMajor
|
||||
read -p "* VersionMajor: " VersionMajor
|
||||
if [ -z "$VersionMajor" ]
|
||||
then
|
||||
echo "VersionMajor cannot be NULL"
|
||||
exit -1
|
||||
fi
|
||||
version+=$VersionMajor
|
||||
|
||||
# VersionMinor
|
||||
read -p "* VersionMinor: " VersionMinor
|
||||
if [ -z "$VersionMinor" ]
|
||||
then
|
||||
echo "VersionMinor cannot be NULL"
|
||||
exit -1
|
||||
fi
|
||||
version+="."$VersionMinor
|
||||
|
||||
# VersionPatch
|
||||
read -p "* VersionPatch: " VersionPatch
|
||||
if [ -z "$VersionPatch" ]
|
||||
then
|
||||
echo "VersionPatch cannot be NULL"
|
||||
exit -1
|
||||
fi
|
||||
version+="."$VersionPatch
|
||||
|
||||
# VersionMeta (optional)
|
||||
read -p "* VersionMeta (optional, press enter if not needed): " VersionMeta
|
||||
if [[ ! -z "$VersionMeta" ]]
|
||||
then
|
||||
version+="-"$VersionMeta
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "New version is: $version"
|
||||
|
||||
# update version in all the 6 templates
|
||||
replace="Version: "$version
|
||||
fileArray=(
|
||||
"${DIR}/../packaging/templates/package_scripts/control"
|
||||
"${DIR}/../packaging/templates/package_scripts/control.arm64"
|
||||
"${DIR}/../packaging/templates/package_scripts/control.profile.amd64"
|
||||
"${DIR}/../packaging/templates/package_scripts/control.profile.arm64"
|
||||
"${DIR}/../packaging/templates/package_scripts/control.validator"
|
||||
"${DIR}/../packaging/templates/package_scripts/control.validator.arm64"
|
||||
)
|
||||
for file in ${fileArray[@]}; do
|
||||
# get the line starting with `Version` in the control file and store it in the $temp variable
|
||||
temp=$(grep "^Version.*" $file)
|
||||
sed -i '' "s%$temp%$replace%" $file
|
||||
done
|
||||
|
||||
# update version in ../params/version.go
|
||||
versionFile="${DIR}/../params/version.go"
|
||||
sed -i '' "s% = .*// Major% = $VersionMajor // Major%g" $versionFile
|
||||
sed -i '' "s% = .*// Minor% = $VersionMinor // Minor%g" $versionFile
|
||||
sed -i '' "s% = .*// Patch% = $VersionPatch // Patch%g" $versionFile
|
||||
sed -i '' "s% = .*// Version metadata% = \"$VersionMeta\" // Version metadata%g" $versionFile
|
||||
gofmt -w $versionFile
|
||||
|
||||
echo ""
|
||||
echo "Updating Version Done"
|
||||
|
||||
exit 0
|
||||
Loading…
Reference in a new issue