From 760dbf348139c9cf65161ed9ee1ccb142ddea333 Mon Sep 17 00:00:00 2001 From: Gary Yu Date: Thu, 17 Jan 2019 02:53:58 +0800 Subject: [PATCH] Use travis-ci to update a release instead of creating new release (#2384) --- .auto-release.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.auto-release.sh b/.auto-release.sh index d1bdfea8c..58518c113 100755 --- a/.auto-release.sh +++ b/.auto-release.sh @@ -2,6 +2,7 @@ repo_slug="mimblewimble/grin" token="$GITHUB_TOKEN" +export CHANGELOG_GITHUB_TOKEN="$token" tagname=`git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD` @@ -42,7 +43,6 @@ LAST_RELEASE_TAG=$(git describe --abbrev=0 --tags ${LAST_REVISION}) github_changelog_generator \ -u $(cut -d "/" -f1 <<< $repo_slug) \ -p $(cut -d "/" -f2 <<< $repo_slug) \ - --token $token \ --since-tag ${LAST_RELEASE_TAG} body="$(cat CHANGELOG.md)" @@ -62,7 +62,8 @@ jq -n \ prerelease: false }' > CHANGELOG.md -echo "Create release $version for repo: $repo_slug, branch: $branch" -curl -H "Authorization: token $token" --data @CHANGELOG.md "https://api.github.com/repos/$repo_slug/releases" +release_id="$(curl -0 -XGET -H "Authorization: token $token" https://api.github.com/repos/garyyu/grin/releases/tags/$tagname 2>/dev/null | grep id | head -n 1 | sed 's/ *"id": *\(.*\),/\1/')" +echo "Updating release $version for repo: $repo_slug, branch: $branch. release id: $release_id" +curl -H "Authorization: token $token" --request PATCH --data @CHANGELOG.md "https://api.github.com/repos/$repo_slug/releases/$release_id" echo "auto changelog uploaded.\n"