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

JMAパラメータ更新用のシェルスクリプトを追加 #584

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .tagpr
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@
[tagpr]
vPrefix = true
releaseBranch = develop
versionFile = -
versionFile = .tagpr.version
releaseBranch = main
4 changes: 4 additions & 0 deletions packages/jma_parameter_converter_internal/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@

parameter/
*_parameter*


/earthquake*
/tsunami*
46 changes: 40 additions & 6 deletions packages/jma_parameter_converter_internal/updater.sh
Original file line number Diff line number Diff line change
@@ -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
Loading