Fetch Git commit (and tag, if exists), with its date
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
Fred Pauchet 2022-01-12 20:24:10 +01:00
parent 547f4a048e
commit f1ca92d846
3 changed files with 14 additions and 1 deletions

View File

@ -78,6 +78,7 @@ TEMPLATES = [
'django.template.context_processors.request', 'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth', 'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages', 'django.contrib.messages.context_processors.messages',
"ultron.core.context_processors.git_describe"
], ],
}, },
}, },

View File

@ -11,7 +11,7 @@
<h4 class=""><i class="icon-primary fal fa-laugh-wink"></i> Hi {{ user.username }} !</h4> <h4 class=""><i class="icon-primary fal fa-laugh-wink"></i> Hi {{ user.username }} !</h4>
</div> </div>
<div class="card-body"> <div class="card-body">
Welcome to Ultron v0.42 <span class="text-muted">(last update : 9-1-2022)</span><br /> Welcome to Ultron {{ git_describe }} <span class="text-muted">(last update : {{ git_date }})</span><br />
This application is there to help us manage the gymnasts (evolution, evaluation, routine, scores, ...). It is not perfect so feel free to make improvement proposals, bug reports, … by sending me an <a href="mailto:gregory@flyingacrobaticstrampoline.be">email</a>.<br/> This application is there to help us manage the gymnasts (evolution, evaluation, routine, scores, ...). It is not perfect so feel free to make improvement proposals, bug reports, … by sending me an <a href="mailto:gregory@flyingacrobaticstrampoline.be">email</a>.<br/>
<br/> <br/>
<span class="text-danger"><b>Gelukkig nieuwjaar 2022 en mijn beste wensen!</b></span> <span class="text-danger"><b>Gelukkig nieuwjaar 2022 en mijn beste wensen!</b></span>

View File

@ -0,0 +1,12 @@
import subprocess
def git_describe(request) -> str:
return {
"git_describe": subprocess.check_output(
["git", "describe", "--always"]
).decode(),
"git_date": subprocess.check_output(
["git", "show", "-s", r"--format=%cd", r"--date=format:%d-%m-%Y"]
).decode(),
}