mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Merge pull request #2048 from inventree/version-tags
Updates for docker workflows:
This commit is contained in:
		| @@ -15,6 +15,9 @@ jobs: | ||||
|     steps: | ||||
|       - name: Checkout Code | ||||
|         uses: actions/checkout@v2 | ||||
|       - name: Check version number | ||||
|         run: | | ||||
|           python3 ci/check_version_number.py --dev | ||||
|       - name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v1 | ||||
|       - name: Set up Docker Buildx | ||||
							
								
								
									
										42
									
								
								.github/workflows/docker_stable.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								.github/workflows/docker_stable.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| # Build and push latest docker image on push to master branch | ||||
|  | ||||
| name: Docker Build | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - 'stable' | ||||
|  | ||||
| jobs: | ||||
|  | ||||
|   docker: | ||||
|     runs-on: ubuntu-latest | ||||
|  | ||||
|     steps: | ||||
|       - name: Checkout Code | ||||
|         uses: actions/checkout@v2 | ||||
|       - name: Check version number | ||||
|         run: | | ||||
|           python3 ci/check_version_number.py --release | ||||
|       - name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v1 | ||||
|       - name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v1 | ||||
|       - name: Login to Dockerhub | ||||
|         uses: docker/login-action@v1 | ||||
|         with: | ||||
|           username: ${{ secrets.DOCKER_USERNAME }} | ||||
|           password: ${{ secrets.DOCKER_PASSWORD }} | ||||
|       - name: Build and Push | ||||
|         uses: docker/build-push-action@v2 | ||||
|         with: | ||||
|           context: ./docker | ||||
|           platforms: linux/amd64,linux/arm64,linux/arm/v7 | ||||
|           push: true | ||||
|           target: production | ||||
|           build-args: | ||||
|             branch: stable | ||||
|           repository: inventree/inventree | ||||
|           tags: inventree/inventree:stable | ||||
|       - name: Image Digest | ||||
|         run: echo ${{ steps.docker_build.outputs.digest }} | ||||
| @@ -15,7 +15,7 @@ jobs: | ||||
|         uses: actions/checkout@v2 | ||||
|       - name: Check Release tag | ||||
|         run: | | ||||
|           python3 ci/check_version_number.py ${{ github.event.release.tag_name }} | ||||
|           python3 ci/check_version_number.py --release --tag ${{ github.event.release.tag_name }} | ||||
|       - name: Set up QEMU | ||||
|         uses: docker/setup-qemu-action@v1 | ||||
|       - name: Set up Docker Buildx | ||||
							
								
								
									
										20
									
								
								.github/workflows/version.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								.github/workflows/version.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| # Check that the version number format matches the current branch | ||||
|  | ||||
| name: Version Numbering | ||||
|  | ||||
| on: | ||||
|   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.base_ref }} | ||||
| @@ -8,7 +8,7 @@ import re | ||||
|  | ||||
| import common.models | ||||
|  | ||||
| INVENTREE_SW_VERSION = "0.5.0 pre" | ||||
| INVENTREE_SW_VERSION = "0.5.0 dev" | ||||
|  | ||||
| INVENTREE_API_VERSION = 12 | ||||
|  | ||||
|   | ||||
| @@ -27,10 +27,59 @@ if __name__ == '__main__': | ||||
|         version = results[0] | ||||
|  | ||||
|     parser = argparse.ArgumentParser() | ||||
|     parser.add_argument('tag', help='Version tag', action='store') | ||||
|     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("- This is a development branch") | ||||
|             args.dev = True | ||||
|         elif args.branch == 'stable': | ||||
|             print("- This is a stable release branch") | ||||
|             args.release = True | ||||
|  | ||||
|     if args.dev: | ||||
|         """ | ||||
|         Check that the current verrsion number matches the "development" format | ||||
|         e.g. "0.5 dev" | ||||
|         """ | ||||
|  | ||||
|         pattern = "^\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) | ||||
|  | ||||
|     elif args.release: | ||||
|         """ | ||||
|         Check that the current version number matches the "release" format | ||||
|         e.g. "0.5.1" | ||||
|         """ | ||||
|  | ||||
|         pattern = "^\d+(\.\d+)+$" | ||||
|  | ||||
|         result = re.match(pattern, version) | ||||
|  | ||||
|         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: | ||||
|             print(f"Release tag '{args.tag}' does not match INVENTREE_SW_VERSION '{version}'") | ||||
|             sys.exit(1) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user