mirror of
https://github.com/giongto35/cloud-game.git
synced 2026-08-05 00:04:12 +00:00
Add version info into the apps (#330)
Both worker and coordinator display version number in the console during startup. Coordinator displays its version number in the top right corner of the index.html page.
This commit is contained in:
parent
cbabe69f30
commit
30d104ee98
8 changed files with 59 additions and 5 deletions
30
scripts/version.sh
vendored
Executable file
30
scripts/version.sh
vendored
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
|
||||
file="$1"
|
||||
version="$2"
|
||||
from="(<span id=\"v\">).*?(<\/span>)"
|
||||
|
||||
# Prints app version derived from git in the following format:
|
||||
#
|
||||
# v2-1-gcafeb
|
||||
# ^ ^ ^ ^
|
||||
# | | | |
|
||||
# | | | '- commit hash of HEAD (1st 5 symbols)
|
||||
# | | '-- "g" stands for git
|
||||
# | '---- n commits since the last tag
|
||||
# '------- last tag
|
||||
#
|
||||
# See: https://git-scm.com/docs/git-describe
|
||||
#
|
||||
# The first input param replaces the version placeholder in the provided file.
|
||||
# The second input param forces the use of some version value instead of a git-derived one.
|
||||
#
|
||||
if [ "$version" = "" ]; then
|
||||
version=$(git describe --abbrev=5 --always --tags 2> /dev/null)
|
||||
fi
|
||||
if [ "$file" != "" ]; then
|
||||
sed -i -E "s/$from/\1$version\2/" "$file"
|
||||
echo "$file $version"
|
||||
else
|
||||
echo "$version"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue