mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add workflow to check version number
This commit is contained in:
parent
429add9000
commit
5ee004eabd
24
.github/workflows/version.yaml
vendored
Normal file
24
.github/workflows/version.yaml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Check that the version number format matches the current branch
|
||||
|
||||
name: Version Numbering
|
||||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- l10*
|
||||
|
||||
pull_request:
|
||||
branches-ignore:
|
||||
- l10*
|
||||
|
||||
jobs:
|
||||
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
- name: Check version number
|
||||
run: |
|
||||
python3 ci/check_version_number.py --branch ${GITHUB_REF##*/}
|
@ -30,9 +30,27 @@ if __name__ == '__main__':
|
||||
parser.add_argument('-t', '--tag', help='Compare against specified version tag', action='store')
|
||||
parser.add_argument('-r', '--release', help='Check that this is a release version', action='store_true')
|
||||
parser.add_argument('-d', '--dev', help='Check that this is a development version', action='store_true')
|
||||
parser.add_argument('-b', '--branch', help='Check against a particular branch', action='store')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.branch:
|
||||
"""
|
||||
Version number requirement depends on format of branch
|
||||
|
||||
'master': development branch
|
||||
'stable': release branch
|
||||
"""
|
||||
|
||||
print(f"Checking version number for branch '{args.branch}'")
|
||||
|
||||
if args.branch == 'master':
|
||||
print("Development branch")
|
||||
args.dev = True
|
||||
elif args.branch == 'stable':
|
||||
print("Stable release branch")
|
||||
args.release = True
|
||||
|
||||
if args.dev:
|
||||
"""
|
||||
Check that the current verrsion number matches the "development" format
|
||||
@ -59,6 +77,7 @@ if __name__ == '__main__':
|
||||
|
||||
if result is None:
|
||||
print(f"Version number '{version}' does not match required pattern for stable branch")
|
||||
sys.exit(1)
|
||||
|
||||
if args.tag:
|
||||
if not args.tag == version:
|
||||
|
Loading…
Reference in New Issue
Block a user