add version number

This commit is contained in:
codl 2017-08-07 14:51:33 +02:00
parent 5b953122c3
commit 646cb04d9a
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
4 changed files with 27 additions and 1 deletions

3
app.py
View File

@ -2,6 +2,7 @@ from flask import Flask
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import MetaData from sqlalchemy import MetaData
from flask_migrate import Migrate from flask_migrate import Migrate
import version
app = Flask(__name__) app = Flask(__name__)
@ -31,4 +32,4 @@ migrate = Migrate(app, db)
sentry = None sentry = None
if 'SENTRY_DSN' in app.config: if 'SENTRY_DSN' in app.config:
from raven.contrib.flask import Sentry from raven.contrib.flask import Sentry
sentry = Sentry(app, dsn=app.config['SENTRY_DSN']) sentry = Sentry(app, dsn=app.config['SENTRY_DSN'], release=version.version)

View File

@ -0,0 +1,19 @@
#!/bin/sh
while read old new refname; do
branch=$(git rev-parse --abbrev-ref=strict ${refname})
if [[ $branch == "deploy" ]]; then
systemctl --user stop forget
GIT_WORK_TREE='/home/codl/forget' git checkout -f deploy
(
cd /home/codl/forget
source venv/bin/activate
pip install -r requirements.txt
tools/write-version.sh
FLASK_APP='forget.py' flask db upgrade
)
systemctl --user start forget
fi
done

5
tools/write-version.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
cd $(dirname $0)/..
git describe --tags --long --always | python -c 'from jinja2 import Template; print(Template("version=\"{{input}}\"").render(input=input()))' > version.py

1
version.py Normal file
View File

@ -0,0 +1 @@
version="dev"