Skip to content

Instantly share code, notes, and snippets.

@ryasmi
Last active October 8, 2017 20:33
Show Gist options
  • Save ryasmi/20591ef8f1f04fabfe649e56901f68e7 to your computer and use it in GitHub Desktop.
Save ryasmi/20591ef8f1f04fabfe649e56901f68e7 to your computer and use it in GitHub Desktop.
A shell script to generate the Moodle plugin version file using git tags and Travis.
release=$(echo "${TRAVIS_TAG//v}")
requires=$REQUIRED_MOODLE_VERSION
today=$(date +"%Y-%m-%d")
todaysReleases=$(git log --tags --simplify-by-decoration --pretty="format:%ai %d" | sort -r | grep "$today" | wc -l | tr -d '[:space:]')
versionPrefix=$(date +"%Y%m%d")
versionSuffix=$(printf %02d $todaysReleases)
version="$versionPrefix$versionSuffix"
template=$(cat template)
eval "echo \"$template\"" > version.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment