mirror of
				https://github.com/KevinMidboe/delugeClient.git
				synced 2025-10-29 12:00:13 +00:00 
			
		
		
		
	If source is newer than pypi, exit 0 and continue pipeline
This commit is contained in:
		| @@ -38,6 +38,11 @@ platform: | |||||||
|   arch: amd64 |   arch: amd64 | ||||||
|  |  | ||||||
| steps: | steps: | ||||||
|  |   - name: Newer version to publish? | ||||||
|  |     image: python:3.10 | ||||||
|  |     commands: | ||||||
|  |       - bash publish_version?.sh | ||||||
|  |  | ||||||
|   - name: Test PyPi publish |   - name: Test PyPi publish | ||||||
|     image: python:3.10 |     image: python:3.10 | ||||||
|     commands:  |     commands:  | ||||||
|   | |||||||
| @@ -1 +1,4 @@ | |||||||
| __version__ = '0.3.1' | __version__ = '0.3.1' | ||||||
|  |  | ||||||
|  | if __name__ == '__main__': | ||||||
|  |   print(__version__) | ||||||
|   | |||||||
							
								
								
									
										20
									
								
								publish_version?.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								publish_version?.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | |||||||
|  | #!/usr/bin/bash | ||||||
|  |  | ||||||
|  | PYPI_VERSION=$(pip3 show delugeClient-kevin | awk '$1 ~ /Version:/ { print $2 }') | ||||||
|  | SOURCE_VERSION=$(python3 delugeClient/__version__.py) | ||||||
|  |  | ||||||
|  | echo "hello" | ||||||
|  | echo "pypi version: $PYPI_VERSION" | ||||||
|  | echo "source version: $SOURCE_VERSION" | ||||||
|  |  | ||||||
|  | function version { | ||||||
|  |   echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | if [ $(version $SOURCE_VERSION) -gt $(version $PYPI_VERSION) ]; then | ||||||
|  |   echo "source is newer than pypi" | ||||||
|  |   exit 0 | ||||||
|  | else | ||||||
|  |   exit 1 | ||||||
|  |   echo "source is same or oldre, but not newer" | ||||||
|  | fi | ||||||
		Reference in New Issue
	
	Block a user