mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Ignore non-version tags
This commit is contained in:
		
							parent
							
								
									f4aa4f1848
								
							
						
					
					
						commit
						a75ddff9f3
					
				
					 1 changed files with 6 additions and 11 deletions
				
			
		| 
						 | 
					@ -1,20 +1,15 @@
 | 
				
			||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get the last tag
 | 
					# Get the last tag
 | 
				
			||||||
TAG=$(git describe --abbrev=0 --tags --match=v* 2>/dev/null)
 | 
					TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" 2>/dev/null)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get the number of commits from the last tag, or if not, from
 | 
					# Get the number of commits from the last tag
 | 
				
			||||||
# the first commit
 | 
					COUNT=$(git rev-list $TAG..HEAD --count 2>/dev/null)
 | 
				
			||||||
COUNT=$( \
 | 
					 | 
				
			||||||
  git rev-list v$TAG..HEAD --count 2>/dev/null || \
 | 
					 | 
				
			||||||
  git rev-list HEAD --count 2>/dev/null \
 | 
					 | 
				
			||||||
)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Check if it matches the vX.Y.Z format
 | 
					# If it fails then there's no last tag - go from the first commit
 | 
				
			||||||
grep "v[0-9]*\.[0-9]*\.[0-9]*" <<< $TAG &>/dev/null
 | 
					if [ $? != 0 ]; then
 | 
				
			||||||
 | 
					  COUNT=$(git rev-list HEAD --count 2>/dev/null)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# If it doesn't, abort
 | 
					 | 
				
			||||||
if [ $? -ne 0 ]; then
 | 
					 | 
				
			||||||
  printf 'v0.0.0-%d' "$COUNT"
 | 
					  printf 'v0.0.0-%d' "$COUNT"
 | 
				
			||||||
  exit -1
 | 
					  exit -1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue