mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	Simplify version_check script (#3152)
* Simplify version_check script - Allow 'x.x.x' or 'x.x.x dev' on master branch (because we need to be able to tag releases from master) - Remove duplicate regex checks - Fix docstrings * Run version check on all branches - Will ensure we cannot merge in duplicate tags * Add requests package * Add requests package
This commit is contained in:
		
							
								
								
									
										1
									
								
								.github/workflows/docker.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/docker.yaml
									
									
									
									
										vendored
									
									
								
							| @@ -35,6 +35,7 @@ jobs: | |||||||
|         uses: actions/checkout@v2 |         uses: actions/checkout@v2 | ||||||
|       - name: Version Check |       - name: Version Check | ||||||
|         run: | |         run: | | ||||||
|  |           pip install requests | ||||||
|           python3 ci/version_check.py |           python3 ci/version_check.py | ||||||
|           echo "git_commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_ENV |           echo "git_commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||||||
|           echo "git_commit_date=$(git show -s --format=%ci)" >> $GITHUB_ENV |           echo "git_commit_date=$(git show -s --format=%ci)" >> $GITHUB_ENV | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								.github/workflows/qc_checks.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/qc_checks.yaml
									
									
									
									
										vendored
									
									
								
							| @@ -91,6 +91,10 @@ jobs: | |||||||
|         cache: 'pip' |         cache: 'pip' | ||||||
|     - name: Run pre-commit Checks |     - name: Run pre-commit Checks | ||||||
|       uses: pre-commit/action@v2.0.3 |       uses: pre-commit/action@v2.0.3 | ||||||
|  |     - name: Check Version | ||||||
|  |       run: | | ||||||
|  |         pip install requests | ||||||
|  |         python3 ci/version_check.py | ||||||
|  |  | ||||||
|   python: |   python: | ||||||
|     name: Tests - inventree-python |     name: Tests - inventree-python | ||||||
|   | |||||||
| @@ -114,7 +114,7 @@ if __name__ == '__main__': | |||||||
|     docker_tags = None |     docker_tags = None | ||||||
|  |  | ||||||
|     if GITHUB_REF_TYPE == 'tag': |     if GITHUB_REF_TYPE == 'tag': | ||||||
|         # GITHUB_REF should be of th eform /refs/heads/<tag> |         # GITHUB_REF should be of the form /refs/heads/<tag> | ||||||
|         version_tag = GITHUB_REF.split('/')[-1] |         version_tag = GITHUB_REF.split('/')[-1] | ||||||
|         print(f"Checking requirements for tagged release - '{version_tag}':") |         print(f"Checking requirements for tagged release - '{version_tag}':") | ||||||
|  |  | ||||||
| @@ -122,8 +122,6 @@ if __name__ == '__main__': | |||||||
|             print(f"Version number '{version}' does not match tag '{version_tag}'") |             print(f"Version number '{version}' does not match tag '{version_tag}'") | ||||||
|             sys.exit |             sys.exit | ||||||
|  |  | ||||||
|         # TODO: Check if there is already a release with this tag! |  | ||||||
|  |  | ||||||
|         if highest_release: |         if highest_release: | ||||||
|             docker_tags = [version_tag, 'stable'] |             docker_tags = [version_tag, 'stable'] | ||||||
|         else: |         else: | ||||||
| @@ -131,17 +129,6 @@ if __name__ == '__main__': | |||||||
|  |  | ||||||
|     elif GITHUB_REF_TYPE == 'branch': |     elif GITHUB_REF_TYPE == 'branch': | ||||||
|         # Otherwise we know we are targetting the 'master' branch |         # Otherwise we know we are targetting the 'master' branch | ||||||
|         print("Checking requirements for 'master' development branch:") |  | ||||||
|  |  | ||||||
|         pattern = r"^\d+(\.\d+)+ dev$" |  | ||||||
|         result = re.match(pattern, version) |  | ||||||
|  |  | ||||||
|         if result is None: |  | ||||||
|             print(f"Version number '{version}' does not match required pattern for development branch") |  | ||||||
|             sys.exit(1) |  | ||||||
|         else: |  | ||||||
|             print(f"Version number '{version}' matches development branch") |  | ||||||
|  |  | ||||||
|         docker_tags = ['latest'] |         docker_tags = ['latest'] | ||||||
|  |  | ||||||
|     else: |     else: | ||||||
| @@ -153,7 +140,7 @@ if __name__ == '__main__': | |||||||
|         sys.exit(1) |         sys.exit(1) | ||||||
|  |  | ||||||
|     if docker_tags is None: |     if docker_tags is None: | ||||||
|         print("Docker tag could not be determined") |         print("Docker tags could not be determined") | ||||||
|         sys.exit(1) |         sys.exit(1) | ||||||
|  |  | ||||||
|     print(f"Version check passed for '{version}'!") |     print(f"Version check passed for '{version}'!") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user