Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Extract version from version.py for docker image tagging

Roland Geiderc89e07862831
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index d99015e7b..5792c0f5e 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -21,6 +21,8 @@ jobs:
build-prod:
name: Build production image ${{ matrix.platform }}
runs-on: ${{ matrix.runner }}
+ outputs:
+ version: ${{ steps.version.outputs.version }}
strategy:
fail-fast: false
matrix:
@@ -43,6 +45,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v6
+ - name: Read version from wger/version.py
+ id: version
+ run: |
+ VERSION=$(sed -n "s/^VERSION = Version('\(.*\)')/\1/p" wger/version.py)
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
@@ -51,7 +59,7 @@ jobs:
# https://github.com/docker/metadata-action
tags: |
type=raw,value=latest
- type=raw,value=2.6-dev
+ type=raw,value=${{ steps.version.outputs.version }}
images: |
${{ env.REGISTRY_IMAGE }}
@@ -140,7 +148,7 @@ jobs:
with:
tags: |
type=raw,value=latest
- type=raw,value=2.6-dev
+ type=raw,value=${{ needs.build-prod.outputs.version }}
images: |
${{ env.REGISTRY_IMAGE }}
diff --git a/wger/version.py b/wger/version.py
index 75bc77389..103870660 100644
--- a/wger/version.py
+++ b/wger/version.py
@@ -36,7 +36,12 @@ MIN_SERVER_VERSION = Version('2.5.0')
"""Minimum version of the server required to run sync commands on this server"""
VERSION = Version('2.6.0-alpha2')
-"""Current version of the app"""
+"""
+Current version of the app
+
+Note that this string is also extracted by .github/workflows/docker.yml and used
+as-is to set the docker version, only use [A-Za-z0-9_.-]
+"""
def get_version(version: Version = None) -> str: