Skip to content

Commit

Permalink
Merge pull request #1069 from j2gg0s/ci-use-find-replace-hardcode
Browse files Browse the repository at this point in the history
ci: use find replace hardcode when modify func Version
  • Loading branch information
j2gg0s authored Nov 21, 2024
2 parents 02d497c + dbbc37d commit 7325f3e
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,23 @@ if [[ "$(uname)" == "Darwin" ]]; then
"s/uptrace\/bun\([^ ]*\) v.*/uptrace\/bun\1 ${TAG}/" "${dir}/go.mod"
done

sed -i "" "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./version.go
sed -i "" "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./dialect/mysqldialect/version.go
sed -i "" "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./dialect/mssqldialect/version.go
sed -i "" "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./dialect/pgdialect/version.go
sed -i "" "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./dialect/sqlitedialect/version.go
sed -i "" "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./dialect/oracledialect/version.go
for file in $(find . -type f -name 'version.go')
do
sed -i "" "/func Version() string/{n;s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/;}" ${file}
done
sed -i "" "s/\(\"version\": \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./package.json

else
for dir in $PACKAGE_DIRS
do
sed --in-place \
"s/uptrace\/bun\([^ ]*\) v.*/uptrace\/bun\1 ${TAG}/" "${dir}/go.mod"
done

sed --in-place "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./version.go
sed --in-place "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./dialect/mysqldialect/version.go
sed --in-place "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./dialect/mssqldialect/version.go
sed --in-place "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./dialect/pgdialect/version.go
sed --in-place "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./dialect/sqlitedialect/version.go
sed --in-place "s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./dialect/oracledialect/version.go
for file in $(find . -type f -name 'version.go')
do
sed --in-place "/func Version() string/{n;s/\(return \)\"[^\"]*\"/\1\"${TAG#v}\"/;}" ${file}
done
sed --in-place "s/\(\"version\": \)\"[^\"]*\"/\1\"${TAG#v}\"/" ./package.json
fi

Expand Down

0 comments on commit 7325f3e

Please sign in to comment.