ypk-deploy-tool/docker/prepareVersion.sh
2022-05-26 15:33:04 +08:00

15 lines
477 B
Bash
Executable File

#!/bin/bash
version=$(awk '/version "[0-9]/ { sub(/[^"]*"/,"") ; sub(/".*$/,""); print $0 } ' build.gradle)
echo version extract from build.gradle '-->' $version
if [ $# -gt 0 ]; then
time=$1
else
time=$(date "+%Y-%m-%d")
fi
echo time is $time
cd ./docker/
awk ' {gsub(/version=\".*\"/,"version=\"'$version'\""); print $0; } ' Dockerfile >Dockerfile.2
awk ' {gsub(/release-date=\".*\"/,"release-date=\"'$time'\""); print $0; } ' Dockerfile.2 >Dockerfile
rm Dockerfile.2