Skip to content

Commit

Permalink
fix: github release
Browse files Browse the repository at this point in the history
  • Loading branch information
antonydenyer committed Nov 27, 2019
1 parent f1e8597 commit b3c9607
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion scripts/common.bash
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,15 @@ ensure_version() {
echo "ERROR: Missing VERSION specify it using an env variable"
exit 1
fi
}
}

ensure_product() {
if [[ -z "$PRODUCT" ]]; then
PRODUCT="${TRAVIS_REPO_SLUG//release\/}"
fi

if [[ "$PRODUCT" = "" ]]; then
echo "ERROR: Missing PRODUCT specify it using an env variable"
exit 1
fi
}
4 changes: 2 additions & 2 deletions scripts/github-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ source "$SCRIPTS_DIR/common.bash"

ensure_version

export PRODUCT=web3j-quorum
ensure_product

export PREVIOUS_RELEASE=$(curl -H "Authorization: token ${GITHUB_PERSONAL_ACCESS_TOKEN}" -s https://api.github.com/repos/web3j/${PRODUCT}/releases/latest | jq -r '.target_commitish' )
export CHANGELOG=$(git rev-list --format=oneline --abbrev-commit --max-count=50 ${PREVIOUS_RELEASE}..HEAD | jq --slurp --raw-input . )
Expand All @@ -40,7 +40,7 @@ API_JSON="{
export RESULT=$(curl -H "Authorization: token ${GITHUB_PERSONAL_ACCESS_TOKEN}" --data "$API_JSON" -s https://api.github.com/repos/web3j/${PRODUCT}/releases)
export UPLOAD_URL=$(echo ${RESULT} | jq -r ".upload_url")

for FILE in `find ./build/libs -type f -name "${PRODUCT}-${VERSION}.*"`;
for FILE in `find ./ -type f -name "${PRODUCT}-${VERSION}.*"`;
do
curl -H "Authorization: token ${GITHUB_PERSONAL_ACCESS_TOKEN}" -s "${UPLOAD_URL:0:-13}?name=$(basename -- $FILE)" -H "Content-Type: $(file -b --mime-type $FILE)" --data-binary @"${FILE}"
done
Expand Down

0 comments on commit b3c9607

Please sign in to comment.