From 827b60fbbfc865c116bc006179ed569684c5a3af Mon Sep 17 00:00:00 2001 From: YumNumm Date: Fri, 23 Feb 2024 02:45:40 +0900 Subject: [PATCH] add --- .tagpr | 3 +- .../.gitignore | 4 ++ .../updater.sh | 46 ++++++++++++++++--- 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/.tagpr b/.tagpr index 7670eb166..30f28a809 100644 --- a/.tagpr +++ b/.tagpr @@ -39,4 +39,5 @@ [tagpr] vPrefix = true releaseBranch = develop - versionFile = - + versionFile = .tagpr.version + releaseBranch = main diff --git a/packages/jma_parameter_converter_internal/.gitignore b/packages/jma_parameter_converter_internal/.gitignore index 4a5c7d1b6..f8db8da31 100644 --- a/packages/jma_parameter_converter_internal/.gitignore +++ b/packages/jma_parameter_converter_internal/.gitignore @@ -4,3 +4,7 @@ parameter/ *_parameter* + + +/earthquake* +/tsunami* \ No newline at end of file diff --git a/packages/jma_parameter_converter_internal/updater.sh b/packages/jma_parameter_converter_internal/updater.sh index 9619aa0eb..085c03377 100755 --- a/packages/jma_parameter_converter_internal/updater.sh +++ b/packages/jma_parameter_converter_internal/updater.sh @@ -1,7 +1,41 @@ #!/usr/bin/env fish -rm earthquake* -rm tsunami* -curl "https://api.dmdata.jp/v2/parameter/earthquake/station" -H "authorization: Basic $(echo "$DMDATA_TOKEN": | base64)" >earthquake_parameter.json -curl "https://api.dmdata.jp/v2/parameter/tsunami/station" -H "authorization: Basic $(echo "$DMDATA_TOKEN": | base64)" >tsunami_parameter.json -fvm dart run ./bin/jma_parameter_converter_internal.dart earthquake_station.json -fvm dart run ./bin/jma_parameter_converter_internal.dart tsunami_station.json +rm earthquake* 2> /dev/null +rm tsunami* 2> /dev/null +curl -qL "https://api.dmdata.jp/v2/parameter/earthquake/station" -H "authorization: Basic $(echo "$DMDATA_TOKEN": | base64)" > earthquake_parameter.json +curl -qL "https://api.dmdata.jp/v2/parameter/tsunami/station" -H "authorization: Basic $(echo "$DMDATA_TOKEN": | base64)" > tsunami_parameter.json +dart run ./bin/jma_parameter_converter_internal.dart earthquake_parameter.json +dart run ./bin/jma_parameter_converter_internal.dart tsunami_parameter.json + +mv earthquake_parameter.buffer earthquake +mv tsunami_parameter.buffer tsunami + +# check should continue or not from stdin +echo "========= Check hash of the files =========" +echo "downloading..." +wrangler r2 object get eqmonitor-prod/parameter/earthquake -f ./earthquake-old +wrangler r2 object get eqmonitor-prod/parameter/tsunami -f ./tsunami-old + +echo "========= Check hash of the files =========" +echo "hash of earthquake old" +set EARTHQUAKE_OLD_HASH $(md5sum earthquake-old | awk '{print $1}') +echo $EARTHQUAKE_OLD_HASH +echo "hash of earthquake new" +set EARTHQUAKE_NEW_HASH $(md5sum earthquake | awk '{print $1}') + +echo "hash of tsunami old" +set TSUNAMI_OLD_HASH $(md5sum tsunami-old | awk '{print $1}') +echo $TSUNAMI_OLD_HASH +echo "hash of tsunami new" +set TSUNAMI_NEW_HASH $(md5sum tsunami | awk '{print $1}') + +echo "========= Check has is same or not =========" +# check if the hash is same or not +# if hash is same, then exit +if test $EARTHQUAKE_OLD_HASH = $EARTHQUAKE_NEW_HASH -a $TSUNAMI_OLD_HASH = $TSUNAMI_NEW_HASH + echo "hash is same. exit" + exit 0 +end + + +wrangler r2 object put eqmonitor-prod/parameter/earthquake -f ./earthquake --ct application/octet-stream +wrangler r2 object put eqmonitor-prod/parameter/tsunami -f ./tsunami --ct application/octet-stream \ No newline at end of file