Skip to content

Commit 5cc0983

Browse files
committed
add version to footer
1 parent 2ebfddd commit 5cc0983

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ name: Build and Release
33
on:
44
push:
55
tags:
6-
- 'v*.*.*' # This will trigger the workflow on version tags, e.g., v1.0.0
6+
- 'v*.*.*'
77

88
jobs:
99
build:
1010
runs-on: ubuntu-latest
11-
permissions:
12-
contents: write
1311

1412
steps:
1513
- name: Checkout code
@@ -18,21 +16,21 @@ jobs:
1816
- name: Set up Python
1917
uses: actions/setup-python@v2
2018
with:
21-
python-version: '3.8' # Specify your Python version
19+
python-version: '3.8'
20+
21+
- name: Get version from tag
22+
id: vars
23+
run: echo "VERSION=${GITHUB_REF#refs/tags/} >> $GITHUB_ENV"
2224

2325
- name: Install dependencies
2426
run: |
2527
python -m pip install --upgrade pip
26-
pip install setuptools wheel
28+
pip install setuptools wheel setuptools-scm
2729
2830
- name: Build package
2931
run: |
3032
python setup.py sdist bdist_wheel
3133
32-
- name: "Build Changelog"
33-
id: build_changelog
34-
uses: mikepenz/release-changelog-builder-action@v5
35-
3634
- name: Upload Package to Release
3735
uses: softprops/action-gh-release@v1
3836
with:

images/journal.png

252 KB
Loading

py_config_gs/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
import json
44
import os
55
import subprocess
6+
from importlib.metadata import version
67

8+
9+
app_version = version('py-config-gs')
710
# Configure logging
811
logging.basicConfig(level=logging.DEBUG, # Set the log level to DEBUG
912
format='%(asctime)s - %(levelname)s - %(message)s')
@@ -61,7 +64,7 @@ def stream():
6164

6265
@app.route('/')
6366
def home():
64-
return render_template('home.html', config_files=config_files)
67+
return render_template('home.html', config_files=config_files, version=app_version)
6568

6669
@app.route('/edit/<filename>', methods=['GET', 'POST'])
6770
def edit(filename):

py_config_gs/templates/footer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<!-- templates/footer.html -->
22
<footer>
3-
<p>&copy; 2024 PyConfig Groundstation</p>
3+
<p>&copy; 2024 PyConfig Groundstation, version: {{ version }}</p>
44
</footer>

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ itsdangerous==2.2.0
66
jinja2==3.1.4
77
MarkupSafe==2.1.5
88
werkzeug==3.0.4
9-
zipp==3.20.2
9+
zipp==3.20.2
10+
setuptools-scm==8.1.0

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import os
2-
from setuptools import setup, find_packages
2+
from setuptools import setup, find_packages, setuptools_scm
33

44
# Define the relative path for the settings file and systemd service file
55
settings_file = 'py_config_gs/settings.json' # Ensure this is a relative path
66
service_file = 'py_config_gs/systemd/py-config-gs.service' # Ensure this is a relative path
77

88
setup(
99
name='py-config-gs',
10-
version='0.1',
10+
use_scm_version=True, # This tells setuptools to use scm for version
11+
setup_requires=['setuptools_scm'],
1112
packages=find_packages(),
1213
include_package_data=True, # Include files from MANIFEST.in
1314
install_requires=[
@@ -21,6 +22,7 @@
2122
'MarkupSafe==2.1.5',
2223
'werkzeug==3.0.4',
2324
'zipp==3.20.2',
25+
'setuptools-scm==8.1.0'
2426
],
2527
entry_points={
2628
'console_scripts': [

0 commit comments

Comments
 (0)