diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 445a1d4..ef56d97 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,6 +20,15 @@ stages: pool: vmImage: ubuntu-latest steps: + - task: Bash@3 + displayName: Read version from version.py + inputs: + targetType: inline + script: | + VERSION=$(python3 -c "import re; content=open('app/version.py').read(); print(re.search(r'VERSION\s*=\s*[\"\'](.*?)[\"\']', content).group(1))") + echo "##vso[task.setvariable variable=semanticVersion]$VERSION" + echo "Image version: $VERSION" + - task: Docker@2 displayName: Build and Push Image inputs: @@ -29,4 +38,5 @@ stages: Dockerfile: '**/Dockerfile' tags: | $(Build.BuildId) - latest \ No newline at end of file + $(semanticVersion) + latest