Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get MySQL, Mroonga, and Groonga versions automatically in update.sh #98

Merged
merged 12 commits into from
Jan 30, 2025
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ $ ./test.sh mysql-8.0 mysql80-mroonga
## How to release

```shell
$ ./update.sh ${MYSQL_VERSION} ${MROONGA_VERSION} ${GROONGA_VERSION}
(./update.sh 8.0.30 12.06 12.0.6)
$ ./update.sh
$ git push
$ git push --tags
```
Expand Down
63 changes: 33 additions & 30 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,44 @@

set -eu

if [ $# != 3 ]; then
echo "Usage: $0 MYSQL_VERSION MROONGA_VERSION GROONGA_VERSION"
echo " e.g.: $0 8.0.30 12.06 12.0.6"
exit 1
fi
target_mysqls=(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
target_mysqls=(
target_mysql_versions=(

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this is right. Please ignore my comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh...

"8.0"
"8.4"
)

mysql_version=$1
mroonga_version=$2
groonga_version=$3
mroonga_version=$(curl https://api.github.com/repos/mroonga/mroonga/releases/latest \
| jq -r '.["tag_name"]' | sed 's/^v//')
groonga_version=$(curl https://api.github.com/repos/groonga/groonga/releases/latest \
| jq -r '.["tag_name"]' | sed 's/^v//')

if type gsed > /dev/null 2>&1; then
SED=gsed
else
SED=sed
fi

case $mysql_version in
8.0.*)
docker_file=mysql-8.0/Dockerfile
;;
esac

${SED} \
-i'' \
-r \
-e "s/mysql:[0-9.]*/mysql:${mysql_version}/g" \
-e "s/mroonga_version=[0-9.]*/mroonga_version=${mroonga_version}/g" \
-e "s/groonga_version=[0-9.]*/groonga_version=${groonga_version}/g" \
${docker_file}
git add ${docker_file}

ruby "$(dirname "$0")/update-tag-list.rb" "$@"
git add README.md

tag="mysql-${mysql_version}-${mroonga_version}"
message="MySQL ${mysql_version} and Mroonga ${mroonga_version}"
git commit -m "${message}"
git tag -a -m "${message}" ${tag}
for target_mysql in "${target_mysqls[@]}"; do
docker_file="mysql-${target_mysql}/Dockerfile"
mysql_version=$(curl https://raw.githubusercontent.com/docker-library/mysql/refs/heads/master/versions.json \
| jq -r ".[\"${target_mysql}\"][\"version\"]")

${SED} \
-i'' \
-r \
-e "s/mysql:[0-9.]*/mysql:${mysql_version}/g" \
-e "s/mroonga_version=[0-9.]*/mroonga_version=${mroonga_version}/g" \
-e "s/groonga_version=[0-9.]*/groonga_version=${groonga_version}/g" \
${docker_file}
git add ${docker_file}

ruby "$(dirname "$0")/update-tag-list.rb" \
"${mysql_version}" \
"${mroonga_version}" \
"${groonga_version}"
git add README.md

tag="mysql-${mysql_version}-${mroonga_version}"
message="MySQL ${mysql_version} and Mroonga ${mroonga_version}"
git commit -m "${message}"
git tag -a -m "${message}" ${tag}
done
Loading