From 01b9022451e0c962a4d5ab50a4aa9eb5e928fc2b Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Wed, 10 Jun 2020 10:07:33 +0200 Subject: [PATCH] version script test --- .github/workflows/docker-publish-dev.yml | 7 +++++++ cookbook/templates/system.html | 5 ++++- cookbook/views/views.py | 5 ++++- recipes/version.py | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 recipes/version.py diff --git a/.github/workflows/docker-publish-dev.yml b/.github/workflows/docker-publish-dev.yml index b777f1da7..39f56c58e 100644 --- a/.github/workflows/docker-publish-dev.yml +++ b/.github/workflows/docker-publish-dev.yml @@ -10,6 +10,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@master + - uses: DamianReeves/write-file-action + with: + path: version.py + contents: | + echo "VERSION_NUMBER = 'develop'" + echo "BUILD_REF = '$(git rev-parse --short "$GITHUB_SHA")'" + write-mode: overwrite - name: Publish to Registry uses: elgohr/Publish-Docker-Github-Action@2.13 with: diff --git a/cookbook/templates/system.html b/cookbook/templates/system.html index 22ec003a1..3b65cccdf 100644 --- a/cookbook/templates/system.html +++ b/cookbook/templates/system.html @@ -16,7 +16,10 @@ Django Recipes is an open source free software application. It can be found on GitHub. Changelogs can be found here. {% endblocktrans %} - +
+
+ Current Version: {{ version }}
+ Ref: {{ ref }}


diff --git a/cookbook/views/views.py b/cookbook/views/views.py index e33eed044..7ecf9ad70 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -20,6 +20,8 @@ from cookbook.forms import * from cookbook.helper.permission_helper import group_required from cookbook.tables import RecipeTable, RecipeTableSmall, CookLogTable, ViewLogTable +from recipes.version import * + def index(request): if not request.user.is_authenticated: @@ -267,7 +269,8 @@ def history(request): @group_required('admin') def system(request): postgres = False if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.postgresql_psycopg2' else True - return render(request, 'system.html', {'gunicorn_media': settings.GUNICORN_MEDIA, 'debug': settings.DEBUG, 'postgres': postgres}) + + return render(request, 'system.html', {'gunicorn_media': settings.GUNICORN_MEDIA, 'debug': settings.DEBUG, 'postgres': postgres, 'version': VERSION_NUMBER, 'ref': BUILD_REF}) def setup(request): diff --git a/recipes/version.py b/recipes/version.py new file mode 100644 index 000000000..6ce6ba4c1 --- /dev/null +++ b/recipes/version.py @@ -0,0 +1,2 @@ +VERSION_NUMBER = "0.0.0" +BUILD_REF = ""