mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-01 01:41:39 +00:00
Portable bump version
This commit is contained in:
parent
f8850c043c
commit
9b67d655f1
@ -8,14 +8,17 @@ fi
|
||||
|
||||
version=$1
|
||||
|
||||
# validate version is in the right format
|
||||
echo $version | sed -r '/v4\.[0-9][0-9]\.[0-9][0-9]?$/!{q1}'
|
||||
# validate version is in the right format (bash regex — portable; GNU sed's q1 is not on macOS)
|
||||
if [[ ! $version =~ ^v4\.[0-9][0-9]\.[0-9][0-9]?$ ]]; then
|
||||
echo "Please specify a valid version (e.g. v4.53.3)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
previousVersion=$(cat cmd/version.go| sed -n 's/.*Version = "\([^"]*\)"/\1/p')
|
||||
|
||||
echo "Updating from $previousVersion to $version"
|
||||
|
||||
sed -i "s/\(.*Version =\).*/\1 \"$version\"/" cmd/version.go
|
||||
sed "s/\(.*Version =\).*/\1 \"$version\"/" cmd/version.go > cmd/version.go.tmp && mv cmd/version.go.tmp cmd/version.go
|
||||
|
||||
go build .
|
||||
actualVersion=$(./yq --version)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user