Script away cargo version bumping
This commit is contained in:
parent
7cabe203dc
commit
926d459c8f
|
@ -12,9 +12,9 @@ When cutting a new channel branch these pre-steps are required:
|
|||
|
||||
1. Pick your branch point for release on master.
|
||||
2. Create the branch. The name should be "v" + the first 2 "version" fields from Cargo.toml. For example, a Cargo.toml with version = "0.9.0" implies the next branch name is "v0.9".
|
||||
3. Update Cargo.toml to the next semantic version (e.g. 0.9.0 -> 0.10.0).
|
||||
3. Update Cargo.toml to the next semantic version (e.g. 0.9.0 -> 0.10.0) by running `./scripts/increment-cargo-version.sh`.
|
||||
4. Push your new branch to solana.git
|
||||
5. Land your Carto.toml change as a master PR.
|
||||
5. Land your Cargo.toml change as a master PR.
|
||||
|
||||
At this point, ci/channel-info.sh should show your freshly cut release branch as "BETA_CHANNEL" and the previous release branch as "STABLE_CHANNEL".
|
||||
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
usage: $0 [major|minor|patch]
|
||||
|
||||
Increments the Cargo.toml version.
|
||||
A minor version increment is the default
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
here="$(dirname "$0")"
|
||||
cd "$here"/..
|
||||
source ci/semver_bash/semver.sh
|
||||
|
||||
readCargoVersion() {
|
||||
declare Cargo_toml="$1"
|
||||
|
||||
while read -r version equals semver _; do
|
||||
if [[ $version = version && $equals = = ]]; then
|
||||
echo "${semver//\"/}"
|
||||
return
|
||||
fi
|
||||
done < <(cat "$Cargo_toml")
|
||||
echo "Unable to locate version in $Cargo_toml" 1>&2
|
||||
}
|
||||
|
||||
MAJOR=0
|
||||
MINOR=0
|
||||
PATCH=0
|
||||
SPECIAL=""
|
||||
semverParseInto "$(readCargoVersion ./Cargo.toml)" MAJOR MINOR PATCH SPECIAL
|
||||
[[ -n $MAJOR ]] || usage
|
||||
|
||||
currentVersion="$MAJOR.$MINOR.$PATCH"
|
||||
|
||||
case ${1:-minor} in
|
||||
patch)
|
||||
PATCH=$((PATCH + 1))
|
||||
;;
|
||||
major)
|
||||
MAJOR=$((MAJOR+ 1))
|
||||
;;
|
||||
minor)
|
||||
MINOR=$((MINOR+ 1))
|
||||
;;
|
||||
*)
|
||||
echo "Error: unknown argument: $1"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
newVersion="$MAJOR.$MINOR.$PATCH"
|
||||
|
||||
for Cargo_toml in {,common/}Cargo.toml; do
|
||||
(
|
||||
set -x
|
||||
sed -i $Cargo_toml -e "s/^version = \"$currentVersion\"$/version = \"$newVersion\"/"
|
||||
)
|
||||
done
|
||||
echo "$currentVersion -> $newVersion"
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue