github.com/ezbuy/gauge@v0.9.4-0.20171013092048-7ac5bd3931cd/build/github_release.sh (about)

     1  # Copyright 2015 ThoughtWorks, Inc.
     2  
     3  # This file is part of Gauge.
     4  
     5  # Gauge is free software: you can redistribute it and/or modify
     6  # it under the terms of the GNU General Public License as published by
     7  # the Free Software Foundation, either version 3 of the License, or
     8  # (at your option) any later version.
     9  
    10  # Gauge is distributed in the hope that it will be useful,
    11  # but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  # GNU General Public License for more details.
    14  
    15  # You should have received a copy of the GNU General Public License
    16  # along with Gauge.  If not, see <http://www.gnu.org/licenses/>.
    17  
    18  if [ -z "$repoName" ]; then
    19    echo "repoName is not set"
    20    exit 1
    21  fi
    22  
    23  if [ -z "$artifactName" ]; then
    24    echo "artifactName is not set"
    25    artifactName=$repoName
    26  fi
    27  
    28  if [ -z "$GITHUB_TOKEN" ]; then
    29    echo "GITHUB_TOKEN is not set"
    30    exit 1
    31  fi
    32  
    33  go get -v -u github.com/aktau/github-release
    34  
    35  version=$(ls $artifactName* | head -1 | sed "s/\.[^\.]*$//" | sed "s/$artifactName-//" | sed "s/-[a-z]*\.[a-z0-9_]*$//");
    36  echo "------------------------------"
    37  echo "Releasing $repoName v$version"
    38  echo "------------------------------"
    39  
    40  release_description=$(ruby -e "$(curl -sSfL https://github.com/getgauge/gauge/raw/master/build/create_release_text.rb)" $repoName)
    41  
    42  $GOPATH/bin/github-release release -u getgauge -r $repoName --draft -t "v$version" -d "$release_description" -n "$repoName $version"
    43  
    44  for i in `ls`; do
    45      $GOPATH/bin/github-release -v upload -u getgauge -r $repoName -t "v$version" -n $i -f $i
    46      if [$? -ne 0];then
    47          exit 1
    48      fi
    49  done