Skip to content

Commit

Permalink
Uploads a pom file to assets (#8)
Browse files Browse the repository at this point in the history
* Uploads a pom file to assets
* Updates ChangeLogs for release v1.1.5
  • Loading branch information
Hirotaka Wakabayashi authored Jan 31, 2020
1 parent 745910e commit 3562042
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ set -u
umask 022

# environments
REPOSITORY_PATH=yahoojapan/k2hdkc_java
SRCDIR=$(cd $(dirname "$0") && pwd)
DEBUG=1
if test "${DEBUG}" -eq 1; then
Expand All @@ -60,7 +61,7 @@ fi
# API SPEC
# https://developer.github.com/v3/repos/releases/#get-the-latest-release
TEMP_FILE=$(mktemp)
curl -sH "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/yahoojapan/k2hdkc_java/releases/latest" -o ${TEMP_FILE}
curl -sH "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/${REPOSITORY_PATH}/releases/latest" -o ${TEMP_FILE}
if test "${?}" != "0"; then
logger -t ${TAG} -p user.error "GitHub API get-the-latest-release returned error."
rm -f ${TEMP_FILE}
Expand Down Expand Up @@ -111,6 +112,22 @@ else
logger -t ${TAG} -p user.info "GitHub API upload-a-release-asset success"
fi

POM_FILE="./pom.xml"
if ! test -f "${POM_FILE}"; then
logger -t ${TAG} -p user.error "${POM_FILE} doesn't exist, which should exist."
rm -f ${TEMP_FILE}
exit 1
fi
POM_ASSET_FILE_NAME="k2hdkc-${TAG_NAME}.pom"
POM_UPLOAD_URL_WITH_QUERY=$(echo ${UPLOAD_URL} | perl -pe "s|{\?name,label}|?name=${POM_ASSET_FILE_NAME}|g")
curl -s --request PATCH -L# --data-binary @"${POM_FILE}" -H "Authorization: token ${GITHUB_TOKEN}" -H "Content-Type: application/xml" ${POM_UPLOAD_URL_WITH_QUERY}
RET=${?}
if test "${RET}" != "0"; then
logger -t ${TAG} -p user.error "GitHub API upload-a-release-asset returned error."
else
logger -t ${TAG} -p user.info "GitHub API upload-a-release-asset success"
fi

rm -f ${TEMP_FILE}
exit ${RET}

7 changes: 6 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
k2hdkc-java (1.1.5) stable; urgency=low

* Uploads a pom file to assets

-- Hirotaka Wakabayashi <[email protected]> Fri, 31 Jan 2020 05:12:06 +0000

k2hdkc-java (1.1.4) stable; urgency=low

* Fixes the wrong GitHub release API endpoint.

-- Hirotaka Wakabayashi <[email protected]> Thu, 30 Jan 2020 23:28:55 +0000

k2hdkc-java (1.1.3) stable; urgency=low

* Uploads a jar file to assets
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>k2hdkc</artifactId>
<packaging>jar</packaging>

<version>1.1.4</version>
<version>1.1.5</version>
<name>k2hdkc</name>
<description>An official java driver for k2hdkc, which is a highly available and scalable distributed KVS clustering system.</description>
<url>https://github.com/yahoojapan/k2hdkc_java</url>
Expand Down

0 comments on commit 3562042

Please sign in to comment.