任务如下:
祝你好运
答案 0 :(得分:1)
在构建脚本的末尾,您可以将日期转储到文件中。在开始时,你可以比较它。它可能看起来像:
currentDate=$(date +%D)
isFirstBuildOfTheDay=true
if [ -e last_date_build.txt ]; then
if [ $currentDate = $(cat last_date_build.txt) ]; then
isFirstBuildOfTheDay=false
fi
fi
if $isFirstBuildOfTheDay; then
#Take a daily snapshot
fi
#Perform the actual build
echo $currentDate > last_date_build.txt
修改以考虑评论:
如果你不能保存文件,那么在标签上记录这个日期呢?
例如:
currentDate=$(date +%F)
dailyTag=daily_$currentDate
if ! git rev-parse $tag >/dev/null 2>&1; then
#Take a daily snapshot
git tag $dailyTag
git push --tags
fi