daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2018 54 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. def getLastCommitHash() {
  2.   return sh(script: 'git log --no-merges -n1 --pretty=format:"%H" HEAD', returnStdout: true).trim()
  3. }
  4.  
  5. def isReleaseTag(string) {
  6.   return string ==~ /^v\d+.\d+.\d+(-\S+)?$/
  7. }
  8.  
  9. def getLatestTag() {
  10.   return sh(script: 'git describe --abbrev=0 --tags', returnStdout: true).trim()
  11. }
  12.  
  13. def isCommitTaggedWithVersion() {
  14.   def latestTag = getLatestTag()
  15.   def isVersionTag = isReleaseTag(latestTag)
  16.  
  17.   if (!isVersionTag) {
  18.     return false
  19.   }
  20.  
  21.   def commitForLatestTag = sh(script: "git rev-list -n 1 ${latestTag}", returnStdout: true).trim()
  22.   def lastCommit = getLastCommitHash()
  23.  
  24.   return commitForLatestTag == lastCommit
  25. }
  26.  
  27. def isPublishable() {
  28.   return (isMaster() || isPR()) && isCommitTaggedWithVersion()
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top