diff --git a/.travis.yml b/.travis.yml index c7a9bfb..880c861 100644 --- a/.travis.yml +++ b/.travis.yml @@ -248,34 +248,30 @@ jobs: -m "Generated v$LFS_VERSION_MAJOR prefixes") git reset --hard # Update major version branches (vN and vN-prefix) - git push https://$GEKY_BOT_RELEASES@github.com/$TRAVIS_REPO_SLUG.git \ + git push --atomic https://$GEKY_BOT_RELEASES@github.com/$TRAVIS_REPO_SLUG.git \ v$LFS_VERSION_MAJOR \ v$LFS_VERSION_MAJOR-prefix - # Create patch version tag (vN.N.N) - curl -f -u "$GEKY_BOT_RELEASES" -X POST \ - https://api.github.com/repos/$TRAVIS_REPO_SLUG/git/refs \ - -d "{ - \"ref\": \"refs/tags/$LFS_VERSION\", - \"sha\": \"$TRAVIS_COMMIT\" - }" - # Create minor release? - [[ "$LFS_VERSION" == *.0 ]] || exit 0 # Build release notes - PREV=$(git tag --sort=-v:refname -l "v*.0" | head -1) + PREV=$(git tag --sort=-v:refname -l "v*" | head -1) if [ ! -z "$PREV" ] then echo "PREV $PREV" - CHANGES=$'### Changes\n\n'$( \ - git log --oneline $PREV.. --grep='^Merge' --invert-grep) + CHANGES=$(git log --oneline $PREV.. --grep='^Merge' --invert-grep) printf "CHANGES\n%s\n\n" "$CHANGES" fi - # Create the release + case ${GEKY_BOT_DRAFT:-minor} in + true) DRAFT=true ;; + minor) DRAFT=$(jq -R 'endswith(".0")' <<< "$LFS_VERSION") ;; + false) DRAFT=false ;; + esac + # Create the release and patch version tag (vN.N.N) curl -f -u "$GEKY_BOT_RELEASES" -X POST \ https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases \ -d "{ \"tag_name\": \"$LFS_VERSION\", \"name\": \"${LFS_VERSION%.0}\", - \"draft\": true, + \"target_commitish\": \"$TRAVIS_COMMIT\", + \"draft\": $DRAFT, \"body\": $(jq -sR '.' <<< "$CHANGES") }" #" SCRIPT