Skip to content

Commit

Permalink
add more release logs (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
pPrecel authored Oct 12, 2023
1 parent 5d57d0c commit 0f0989d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ uploadFile() {
filePath=${1}
ghAsset=${2}

echo "Uploading ${filePath} as ${ghAsset}"
response=$(curl -s -o output.txt -w "%{http_code}" \
--request POST --data-binary @"$filePath" \
-H "Authorization: token $BOT_GITHUB_TOKEN" \
Expand Down Expand Up @@ -41,27 +42,29 @@ MODULE_VERSION=${PULL_BASE_REF} make module-build
echo "Generated moduletemplate.yaml:"
cat moduletemplate.yaml

echo "Updating github release with keda-manager.yaml"

echo "Finding release id for: ${PULL_BASE_REF}"
echo "Fetching releases"
CURL_RESPONSE=$(curl -w "%{http_code}" -sL \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $BOT_GITHUB_TOKEN"\
https://api.github.com/repos/kyma-project/keda-manager/releases)
JSON_RESPONSE=$(sed '$ d' <<< "${CURL_RESPONSE}")
HTTP_CODE=$(tail -n1 <<< "${CURL_RESPONSE}")
if [[ "${HTTP_CODE}" != "200" ]]; then
echo "${JSON_RESPONSE}" && exit 1
echo "${CURL_RESPONSE}"
exit 1
fi

echo "Finding release id for: ${PULL_BASE_REF}"
RELEASE_ID=$(jq <<< ${JSON_RESPONSE} --arg tag "${PULL_BASE_REF}" '.[] | select(.tag_name == $ARGS.named.tag) | .id')

echo "Got '${RELEASE_ID}' release id"
if [ -z "${RELEASE_ID}" ]
then
echo "No release with tag = ${PULL_BASE_REF}"
exit 1
fi

echo "Updating github release with assets"
UPLOAD_URL="https://uploads.github.com/repos/kyma-project/keda-manager/releases/${RELEASE_ID}/assets"

uploadFile "keda-manager.yaml" "${UPLOAD_URL}?name=keda-manager.yaml"
Expand Down

0 comments on commit 0f0989d

Please sign in to comment.