Skip to content

Commit

Permalink
Get MySQL, Mroonga, and Groonga versions automatically in update.sh (#98
Browse files Browse the repository at this point in the history
)

Usage: `./update.sh`

The result of execution of `./update.sh` as below.

```diff
Date:   Thu Jan 30 11:29:55 2025 +0900

    MySQL 8.0.41 and Mroonga 14.13

diff --git a/README.md b/README.md
index 7c5ad8d..2397169 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,8 @@ Currently, groonga/mroonga provides these couples of versions.
 
 | tag                    | MySQL  | Mroonga | Groonga |
 |------------------------|--------|---------|---------|
-| mysql-8.0-latest       | 8.0.40 | 14.12   | 14.1.2  |
+| mysql-8.0-latest       | 8.0.41 | 14.13   | 14.1.3  |
+| mysql-8.0.41-14.13     | 8.0.41 | 14.13   | 14.1.3  |
 | mysql-8.0.40-14.12     | 8.0.40 | 14.12   | 14.1.2  |
 | mysql-8.0.30-12.06     | 8.0.30 | 12.06   | 12.0.6  |
 | mysql-8.0.29-12.04     | 8.0.29 | 12.04   | 12.0.4  |
diff --git a/mysql-8.0/Dockerfile b/mysql-8.0/Dockerfile
index ed6b805..e7fbbec 100644
--- a/mysql-8.0/Dockerfile
+++ b/mysql-8.0/Dockerfile
@@ -1,4 +1,4 @@
-FROM mysql:8.0.40-oraclelinux9
+FROM mysql:8.0.41-oraclelinux9
 
 # TODO
 # Remove `--setopt=apache-arrow-almalinux.gpgcheck=0` option.
@@ -8,8 +8,8 @@ FROM mysql:8.0.40-oraclelinux9
 # error: failed to parse public key for /var/cache/yum/metadata/apache-arrow-almalinux-9-x86_64/RPM-GPG-KEY-Apache-Arrow
 # ```
 
-ENV groonga_version=14.1.2 \
-    mroonga_version=14.12
+ENV groonga_version=14.1.3 \
+    mroonga_version=14.13
 
 RUN mkdir -p /etc/mysql/mysql.conf.d && \
     touch /etc/mysql/mysql.conf.d/default-auth-override.cnf && \
@@ -33,6 +33,6 @@ RUN mkdir -p /docker-entrypoint-mroonga-initdb.d && \
       -e 's,docker_process_init_files /,docker_process_init_files /docker-entrypoint-mroonga-initdb.d/* /,g' \
       /usr/local/bin/docker-entrypoint.sh
 
-# mysql:8.0.40 image has DB in /var/lib/mysql/.
+# mysql:8.0.41 image has DB in /var/lib/mysql/.
 # This clears /var/lib/mysql/ to ensure creating a new DB on "docker run".
 VOLUME ["/var/lib/mysql"]
```

---------

Co-authored-by: Sutou Kouhei <[email protected]>
  • Loading branch information
komainu8 and kou authored Jan 30, 2025
1 parent 05c951e commit 640ea1c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 32 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,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=(
"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

0 comments on commit 640ea1c

Please sign in to comment.