update script
agola/module-packer/Build image The run finished successfully Details

This commit is contained in:
Pavel Dmitriev 2022-05-03 00:46:42 +03:00
parent 95b85af0f5
commit 3adb6b618d
2 changed files with 14 additions and 18 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/*.zip /*.zip
/.env /.env
/src /src
/test

31
pack.sh
View File

@ -1,23 +1,21 @@
#!/bin/bash #!/bin/bash
if [ ! -f .env ]
if [ -f ".env" ]
then then
echo "Config not found" source .env
exit
fi fi
source .env echo ${REG_LOGIN}
rm -rf ./src
cp -r "${mod_path}" "./src"
# TODO: implement .modignore processing from current dir and from src # TODO: implement .modignore processing from current dir and from src
rm -rf .git
md5=`find ./src -type f -exec md5sum {} + | awk '{print $1}' | sort | md5sum | awk '{ print $1 }'` md5=`find . -type f -exec md5sum {} + | awk '{print $1}' | sort | md5sum | awk '{ print $1 }'`
if [ -f "src/module.json" ] if [ -f "module.json" ]
then then
mod_name=`cat src/module.json | jq ".name" -r` mod_name=`cat module.json | jq ".name" -r`
mod_version=`cat src/module.json | jq ".version" -r` mod_version=`cat module.json | jq ".version" -r`
mod_title=`cat src/module.json | jq ".title" -r` mod_title=`cat module.json | jq ".title" -r`
else else
echo "Moduleinfo read failed" echo "Moduleinfo read failed"
exit 9 exit 9
@ -28,16 +26,13 @@ echo "{
\"version\":\"${mod_version}\", \"version\":\"${mod_version}\",
\"title\":\"${mod_title}\", \"title\":\"${mod_title}\",
\"hash\":\"${md5}\" \"hash\":\"${md5}\"
}" > src/module.json }" > module.json
zip_name="mod_$mod_name-v$mod_version.zip" zip_name="mod_$mod_name-v$mod_version.zip"
rm -f mod_*.zip rm -f mod_*.zip
cd src zip -r /tmp/$zip_name .
zip -r ../$zip_name .
cd -
rm -rf src
curl --user ${REG_LOGIN}:${REG_PASSWORD} \ curl --user ${REG_LOGIN}:${REG_PASSWORD} \
--upload-file ${zip_name} \ --upload-file /tmp/${zip_name} \
https://mxfox.ru/api/packages/${REG_REPOS}/generic/${mod_name}/${mod_version}/${mod_name}.zip https://mxfox.ru/api/packages/${REG_REPOS}/generic/${mod_name}/${mod_version}/${mod_name}.zip