Skip to content

Commit

Permalink
release.bash: make work on macOS
Browse files Browse the repository at this point in the history
macOS's sed always considers the parameter following -i to be an
extension, so "-i -e" means "edit in place saving backup with a -e
extension".

macOS's sed does not support \s in regexps.

Change-Id: Ic9b57baa5fc88fff2251c640d11ed417a7257f13
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/322449
Trust: Damien Neil <[email protected]>
Run-TryBot: Damien Neil <[email protected]>
Reviewed-by: Joe Tsai <[email protected]>
  • Loading branch information
neild committed May 25, 2021
1 parent febffdd commit 426f20b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ git change release
git sync

# Create commit for actual release.
sed -i -e "s/\(\s*Minor\s*=\s*\)[0-9]*/\1$VERSION_MINOR/" internal/version/version.go
sed -i -e "s/\(\s*Patch\s*=\s*\)[0-9]*/\1$VERSION_PATCH/" internal/version/version.go
sed -i -e "s/\(\s*PreRelease\s*=\s*\)\"[^\"]*\"/\1\"$VERSION_PRERELEASE\"/" internal/version/version.go
sed -i "" -e "s/\(Minor *= *\)[0-9]*/\1$VERSION_MINOR/" internal/version/version.go
sed -i "" -e "s/\(Patch *= *\)[0-9]*/\1$VERSION_PATCH/" internal/version/version.go
sed -i "" -e "s/\(PreRelease *= *\)\"[^\"]*\"/\1\"$VERSION_PRERELEASE\"/" internal/version/version.go
if ! [[ -z $GEN_VERSION ]]; then
sed -i -e "s/\(\s*GenVersion\s*=\s*\)[0-9]*/\1$GEN_VERSION/" runtime/protoimpl/version.go
sed -i "" -e "s/\(GenVersion *= *\)[0-9]*/\1$GEN_VERSION/" runtime/protoimpl/version.go
fi
if ! [[ -z $MIN_VERSION ]]; then
sed -i -e "s/\(\s*MinVersion\s*=\s*\)[0-9]*/\1$MIN_VERSION/" runtime/protoimpl/version.go
sed -i "" -e "s/\(MinVersion *= *\)[0-9]*/\1$MIN_VERSION/" runtime/protoimpl/version.go
fi
git commit -a -m "all: release $(version_string)"

Expand All @@ -80,7 +80,7 @@ go test -mod=vendor -timeout=60m -count=1 integration_test.go "$@" -buildRelease
# Create commit to start development after release.
VERSION_PRERELEASE="${VERSION_PRERELEASE}.devel" # append ".devel"
VERSION_PRERELEASE="${VERSION_PRERELEASE#"."}" # trim possible leading "."
sed -i -e "s/\(\s*PreRelease\s*=\s*\)\"[^\"]*\"/\1\"$VERSION_PRERELEASE\"/" internal/version/version.go
sed -i "" -e "s/\(PreRelease *= *\)\"[^\"]*\"/\1\"$VERSION_PRERELEASE\"/" internal/version/version.go
git commit -a -m "all: start $(version_string)"

echo
Expand Down

0 comments on commit 426f20b

Please sign in to comment.