mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Merge pull request #219 from neilalexander/semver
Tag releases in master using CI
This commit is contained in:
		
						commit
						4532d0e0c8
					
				
					 3 changed files with 18 additions and 3 deletions
				
			
		| 
						 | 
					@ -18,6 +18,8 @@ jobs:
 | 
				
			||||||
              mkdir /tmp/upload
 | 
					              mkdir /tmp/upload
 | 
				
			||||||
              echo 'export CINAME=$(sh contrib/semver/name.sh)' >> $BASH_ENV
 | 
					              echo 'export CINAME=$(sh contrib/semver/name.sh)' >> $BASH_ENV
 | 
				
			||||||
              echo 'export CIVERSION=$(sh contrib/semver/version.sh | cut -c 2-)' >> $BASH_ENV
 | 
					              echo 'export CIVERSION=$(sh contrib/semver/version.sh | cut -c 2-)' >> $BASH_ENV
 | 
				
			||||||
 | 
					              git config --global user.email "$(git log --format='%ae' HEAD -1)";
 | 
				
			||||||
 | 
					              git config --global user.name "$(git log --format='%an' HEAD -1)";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      - run:
 | 
					      - run:
 | 
				
			||||||
          name: Install alien
 | 
					          name: Install alien
 | 
				
			||||||
| 
						 | 
					@ -98,3 +100,13 @@ jobs:
 | 
				
			||||||
      - store_artifacts:
 | 
					      - store_artifacts:
 | 
				
			||||||
          path: /tmp/upload
 | 
					          path: /tmp/upload
 | 
				
			||||||
          destination: /
 | 
					          destination: /
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - run:
 | 
				
			||||||
 | 
					          name: Create tags (master branch only)
 | 
				
			||||||
 | 
					          command: >
 | 
				
			||||||
 | 
					              if [ "${CIRCLE_BRANCH}" == "master" ]; then
 | 
				
			||||||
 | 
					                git tag -f -a $(sh contrib/semver/version.sh) -m "Created by CircleCI" && git push -f --tags;
 | 
				
			||||||
 | 
					              else
 | 
				
			||||||
 | 
					                echo "Only runs for master branch (this is ${CIRCLE_BRANCH})";
 | 
				
			||||||
 | 
					              fi;
 | 
				
			||||||
 | 
					          when: on_success
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								contrib/.DS_Store
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								contrib/.DS_Store
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -4,7 +4,7 @@
 | 
				
			||||||
DEVELOPBRANCH="yggdrasil-network/develop"
 | 
					DEVELOPBRANCH="yggdrasil-network/develop"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get the last tag
 | 
					# Get the last tag
 | 
				
			||||||
TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*" 2>/dev/null)
 | 
					TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.0" 2>/dev/null)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get last merge to master
 | 
					# Get last merge to master
 | 
				
			||||||
MERGE=$(git rev-list $TAG..master --grep "from $DEVELOPBRANCH" 2>/dev/null | head -n 1)
 | 
					MERGE=$(git rev-list $TAG..master --grep "from $DEVELOPBRANCH" 2>/dev/null | head -n 1)
 | 
				
			||||||
| 
						 | 
					@ -32,7 +32,11 @@ BRANCH=$(git rev-parse --abbrev-ref HEAD)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Output in the desired format
 | 
					# Output in the desired format
 | 
				
			||||||
if [ $PATCH = 0 ]; then
 | 
					if [ $PATCH = 0 ]; then
 | 
				
			||||||
  printf 'v%d.%d' "$MAJOR" "$MINOR"
 | 
					  if [ ! -z $FULL ]; then
 | 
				
			||||||
 | 
					    printf 'v%d.%d.0' "$MAJOR" "$MINOR"
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    printf 'v%d.%d' "$MAJOR" "$MINOR"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  printf 'v%d.%d.%d' "$MAJOR" "$MINOR" "$PATCH"
 | 
					  printf 'v%d.%d.%d' "$MAJOR" "$MINOR" "$PATCH"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
| 
						 | 
					@ -43,4 +47,3 @@ if [ $BRANCH != "master" ]; then
 | 
				
			||||||
    printf -- "-%04d" "$BUILD"
 | 
					    printf -- "-%04d" "$BUILD"
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue