Skip to content

Instantly share code, notes, and snippets.

@ip413
Last active May 26, 2021 10:41
Show Gist options
  • Save ip413/b4534b02620111d18ec4b645c847e84e to your computer and use it in GitHub Desktop.
Save ip413/b4534b02620111d18ec4b645c847e84e to your computer and use it in GitHub Desktop.
App verison number generator from date and git commit hash
<html>
<head>
</head>
<span>
__APP_VERSION__
</span>
</html>
#!/bin/bash
# Generates app version string in form: "2017-05-08--10-24-35--b306d134"
#
# String format:
# - 2017-05-08 is a date (YYYY-MM-DD),
# - 10.24 is hour and minutes (HH-MM-SS) and
# - b306d134 is a last commit hash from local repo.
# Usage:
# sed -i "s/__APP_VERSION__/$(./set_app_version.sh)/" index.html
echo $(date +'%Y-%m-%d--%H-%M-%S--')$(git log --format="%H" -n 1 | cut -c 1-7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment