mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1918 from SchrodingersGat/version-number-check
Check release tag before publishing docker image
This commit is contained in:
commit
7629077deb
3
.github/workflows/docker_publish.yaml
vendored
3
.github/workflows/docker_publish.yaml
vendored
@ -13,6 +13,9 @@ jobs:
|
||||
steps:
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Check Release tag
|
||||
run: |
|
||||
python3 ci/check_version_number.py ${{ github.event.release.tag_name }}
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
|
38
ci/check_version_number.py
Normal file
38
ci/check_version_number.py
Normal file
@ -0,0 +1,38 @@
|
||||
"""
|
||||
On release, ensure that the release tag matches the InvenTree version number!
|
||||
"""
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
import argparse
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
version_file = os.path.join(here, '..', 'InvenTree', 'InvenTree', 'version.py')
|
||||
|
||||
with open(version_file, 'r') as f:
|
||||
|
||||
results = re.findall(r'INVENTREE_SW_VERSION = "(.*)"', f.read())
|
||||
|
||||
if not len(results) == 1:
|
||||
print(f"Could not find INVENTREE_SW_VERSION in {version_file}")
|
||||
sys.exit(1)
|
||||
|
||||
version = results[0]
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('tag', help='Version tag', action='store')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if not args.tag == version:
|
||||
print(f"Release tag '{args.tag}' does not match INVENTREE_SW_VERSION '{version}'")
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(0)
|
Loading…
Reference in New Issue
Block a user