Write Version / Build Number Tag into README.md

This commit is contained in:
Mitchell Krog 2017-06-02 09:47:42 +02:00
parent 83c866eb93
commit ca8d9d4bcf
3 changed files with 46 additions and 0 deletions

43
travisCI/modify-readme.sh Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
# Write Build / Version Number into README.md
# Created by: https://github.com/mitchellkrogza (mitchellkrog@gmail.com)
# Copyright: Mitchell Krog - https://github.com/mitchellkrogza
# Start time of script generation
versionyear=$(date +%Y)
versionmonth=$(date +%m)
MY_GIT_TAG=V3.$versionyear.$versionmonth.$TRAVIS_BUILD_NUMBER
# Set Temporary database and variables
_inputdbA=/tmp/lastupdated.db
_tmpnginxA=tmpnginxA
# Start and End Strings to Search for to do inserts into template
_startmarker="### --"
_endmarker="-- ###"
# PRINT VERSION INFORMATION INTO GLOBALBLACKLIST FILE 1
# *****************************************************
VERSIONUMBER=$IFS
IFS=$'\n'
echo $_startmarker >> $_tmpnginxA
printf " Version: "$MY_GIT_TAG "" >> $_tmpnginxA
echo $_endmarker >> $_tmpnginxA
IFS=$VERSIONUMBER
mv $_tmpnginxA $_inputdbA
ed -s $_inputdbA<<\IN
1,/### --/d
/-- ###/,$d
,d
.r /home/travis/build/mitchellkrogza/nginx-ultimate-bad-bot-blocker/README.md
/### --/x
.t.
.,/-- ###/-d
#,p
#,p used to print output replaced with w below to write
w /home/travis/build/mitchellkrogza/nginx-ultimate-bad-bot-blocker/README.md
q
IN
rm $_inputdbA
exit 0