Skip to content

Instantly share code, notes, and snippets.

@fernandovaller
Last active May 18, 2022 13:44
Show Gist options
  • Save fernandovaller/274d2ac379e0285af34d5106ed580a53 to your computer and use it in GitHub Desktop.
Save fernandovaller/274d2ac379e0285af34d5106ed580a53 to your computer and use it in GitHub Desktop.
Solution can be to use the Git tags to automatically generate the version number

Put this in a file called pre-push in .git/hooks/

#!/bin/sh
VERSION=$(git rev-list HEAD --count)
echo "Version number is: $VERSION"
sed -i -e "/.*RELEASE_VERSION*./ s/.*/define('RELEASE_VERSION', '${VERSION}');/" config/geral.php
# Optional step
# git add config/geral.php &&
# git commit -m "update release version for ${VERSION}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment