Skip to content
This repository was archived by the owner on May 13, 2020. It is now read-only.

Reset color codes in release scripts #129

Merged
merged 1 commit into from
Nov 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions .ci-scripts/release/announce-a-release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ source "${base}/config.bash"
# we need to run this by hand. Otherwise the GitHub actions environment should
# provide all of these if properly configured
if [[ -z "${APPLICATION_NAME}" ]]; then
echo -e "\e[31mName of the application being announced needs to be set in APPLICATION_NAME. Exiting."
echo -e "\e[31mName of the application being announced needs to be set in APPLICATION_NAME."
echo -e "Exiting.\e[0m"
exit 1
fi

Expand All @@ -38,7 +39,7 @@ if [[ -z "${RELEASE_TOKEN}" ]]; then
echo -e "\e[31m USERNAME:TOKEN"
echo -e "\e[31mfor example:"
echo -e "\e[31m ponylang-main:1234567890"
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

Expand All @@ -47,20 +48,21 @@ if [[ -z "${GITHUB_REF}" ]]; then
echo -e "\e[31mThe tag should be in the following GitHub specific form:"
echo -e "\e[31m /refs/tags/announce-X.Y.Z"
echo -e "\e[31mwhere X.Y.Z is the version we are announcing"
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

if [[ -z "${GITHUB_REPOSITORY}" ]]; then
echo -e "\e[31mName of this repository needs to be set in GITHUB_REPOSITORY."
echo -e "\e[31mShould be in the form OWNER/REPO, for example:"
echo -e "\e[31m ponylang/ponyup"
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

if [[ -z "${ZULIP_TOKEN}" ]]; then
echo -e "\e[31mA Zulip access token needs to be set in ZULIP_TOKEN. Exiting."
echo -e "\e[31mA Zulip access token needs to be set in ZULIP_TOKEN."
echo -e "Exiting.\e[0m"
exit 1
fi

Expand All @@ -81,7 +83,7 @@ PUSH_TO="https://${RELEASE_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
VERSION="${GITHUB_REF/refs\/tags\/announce-/}"

# Prepare release notes
echo -e "\e[34mPreparing to update GitHub release notes..."
echo -e "\e[34mPreparing to update GitHub release notes...\e[0m"
body=$(changelog-tool get "${VERSION}")

jsontemplate="
Expand All @@ -98,18 +100,18 @@ json=$(jq -n \
"${jsontemplate}")

# Upload release notes
echo -e "\e[34mUploading release notes..."
echo -e "\e[34mUploading release notes...\e[0m"
result=$(curl -s -X POST "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases" \
-H "Content-Type: application/x-www-form-urlencoded" \
-u "${RELEASE_TOKEN}" \
--data "${json}")

rslt_scan=$(echo "${result}" | jq -r '.id')
if [ "$rslt_scan" != null ]; then
echo -e "\e[34mRelease notes uploaded"
echo -e "\e[34mRelease notes uploaded\e[0m"
else
echo -e "\e[31mUnable to upload release notes, here's the curl output..."
echo -e "\e[31m${result}"
echo -e "\e[31m${result}\e[0m"
exit 1
fi

Expand All @@ -128,7 +130,7 @@ curl -s -X POST https://ponylang.zulipchat.com/api/v1/messages \
-d "content=${message}"

# Update Last Week in Pony
echo -e "\e[34mAdding release to Last Week in Pony..."
echo -e "\e[34mAdding release to Last Week in Pony...\e[0m"

result=$(curl https://api.github.com/repos/ponylang/ponylang-website/issues?labels=last-week-in-pony)

Expand Down Expand Up @@ -157,15 +159,15 @@ See the [release notes](https://github.com/${GITHUB_REPOSITORY}/releases/tag/${V

rslt_scan=$(echo "${result}" | jq -r '.id')
if [ "$rslt_scan" != null ]; then
echo -e "\e[34mRelease notice posted to LWIP"
echo -e "\e[34mRelease notice posted to LWIP\e[0m"
else
echo -e "\e[31mUnable to post to LWIP, here's the curl output..."
echo -e "\e[31m${result}"
echo -e "\e[31m${result}\e[0m"
fi
else
echo -e "\e[31mUnable to post to Last Week in Pony. Can't find the issue."
fi

# delete announce-VERSION tag
echo -e "\e[34mDeleting no longer needed remote tag announce-${VERSION}"
echo -e "\e[34mDeleting no longer needed remote tag announce-${VERSION}\e[0m"
git push --delete ${PUSH_TO} "announce-${VERSION}"
4 changes: 2 additions & 2 deletions .ci-scripts/release/build-docker-images-on-release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [[ -z "${GITHUB_REF}" ]]; then
echo -e "\e[31mThe tag should be in the following GitHub specific form:"
echo -e "\e[31m /refs/tags/X.Y.Z"
echo -e "\e[31mwhere X.Y.Z is the version we are releasing"
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

Expand All @@ -36,7 +36,7 @@ if [[ -z "${GITHUB_REPOSITORY}" ]]; then
echo -e "\e[31mShould be in the form OWNER/REPO, for example:"
echo -e "\e[31m ponylang/ponyup"
echo -e "\e[31mThis will be used as the docker image name."
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

Expand Down
22 changes: 11 additions & 11 deletions .ci-scripts/release/start-a-release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if [[ -z "${RELEASE_TOKEN}" ]]; then
echo -e "\e[31m USERNAME:TOKEN"
echo -e "\e[31mfor example:"
echo -e "\e[31m ponylang-main:1234567890"
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

Expand All @@ -45,15 +45,15 @@ if [[ -z "${GITHUB_REF}" ]]; then
echo -e "\e[31mThe tag should be in the following GitHub specific form:"
echo -e "\e[31m /refs/tags/release-X.Y.Z"
echo -e "\e[31mwhere X.Y.Z is the version we are releasing"
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

if [[ -z "${GITHUB_REPOSITORY}" ]]; then
echo -e "\e[31mName of this repository needs to be set in GITHUB_REPOSITORY."
echo -e "\e[31mShould be in the form OWNER/REPO, for example:"
echo -e "\e[31m ponylang/ponyup"
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

Expand All @@ -80,24 +80,24 @@ git checkout master
git pull

# update VERSION
echo -e "\e[34mUpdating VERSION to ${VERSION}"
echo -e "\e[34mUpdating VERSION to ${VERSION}\e[0m"
echo "${VERSION}" > VERSION

# version the changelog
echo -e "\e[34mUpdating CHANGELOG.md for release"
echo -e "\e[34mUpdating CHANGELOG.md for release\e[0m"
changelog-tool release "${VERSION}" -e

# commit CHANGELOG and VERSION updates
echo -e "\e[34mCommiting VERSION and CHANGELOG.md changes"
echo -e "\e[34mCommiting VERSION and CHANGELOG.md changes\e[0m"
git add CHANGELOG.md VERSION
git commit -m "${VERSION} release"

# tag release
echo -e "\e[34mTagging for release to kick off building artifacts"
echo -e "\e[34mTagging for release to kick off building artifacts\e[0m"
git tag "${VERSION}"

# push to release to remote
echo -e "\e[34mPushing commited changes back to master"
echo -e "\e[34mPushing commited changes back to master\e[0m"
git push ${PUSH_TO} master
echo -e "\e[34mPushing ${VERSION} tag"
git push ${PUSH_TO} "${VERSION}"
Expand All @@ -106,17 +106,17 @@ git push ${PUSH_TO} "${VERSION}"
git pull

# update CHANGELOG for new entries
echo -e "\e[34mAdding new 'unreleased' section to CHANGELOG.md"
echo -e "\e[34mAdding new 'unreleased' section to CHANGELOG.md\e[0m"
changelog-tool unreleased -e

# commit changelog and push to master
echo -e "\e[34mCommiting CHANGELOG.md change"
git add CHANGELOG.md
git commit -m "Add unreleased section to CHANGELOG post ${VERSION} release [skip ci]"

echo -e "\e[34mPushing CHANGELOG.md"
echo -e "\e[34mPushing CHANGELOG.md\e[0m"
git push ${PUSH_TO} master

# delete release-VERSION tag
echo -e "\e[34mDeleting no longer needed remote tag release-${VERSION}"
echo -e "\e[34mDeleting no longer needed remote tag release-${VERSION}\e[0m"
git push --delete ${PUSH_TO} "release-${VERSION}"
8 changes: 4 additions & 4 deletions .ci-scripts/release/trigger-release-announcement.bash
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if [[ -z "${RELEASE_TOKEN}" ]]; then
echo -e "\e[31m USERNAME:TOKEN"
echo -e "\e[31mfor example:"
echo -e "\e[31m ponylang-main:1234567890"
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

Expand All @@ -42,7 +42,7 @@ if [[ -z "${GITHUB_REF}" ]]; then
echo -e "\e[31mThe tag should be in the following GitHub specific form:"
echo -e "\e[31m /refs/tags/X.Y.Z"
echo -e "\e[31mwhere X.Y.Z is the version we are announcing"
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

Expand All @@ -62,9 +62,9 @@ PUSH_TO="https://${RELEASE_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
VERSION="${GITHUB_REF/refs\/tags\//}"

# tag for announcement
echo -e "\e[34mTagging to kick off release announcement"
echo -e "\e[34mTagging to kick off release announcement\e[0m"
git tag "announce-${VERSION}"

# push tag
echo -e "\e[34mPushing announce-${VERSION} tag"
echo -e "\e[34mPushing announce-${VERSION} tag\e[0m"
git push ${PUSH_TO} "announce-${VERSION}"
17 changes: 9 additions & 8 deletions .ci-scripts/release/x86-64-unknown-linux.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,29 @@ source "${base}/config.bash"
# we need to run this by hand. Otherwise the GitHub actions environment should
# provide all of these if properly configured
if [[ -z "${CLOUDSMITH_API_KEY}" ]]; then
echo -e "\e[31mCloudsmith API key needs to be set in CLOUDSMITH_API_KEY. Exiting."
echo -e "\e[31mCloudsmith API key needs to be set in CLOUDSMITH_API_KEY."
echo -e "Exiting.\e[0m"
exit 1
fi

if [[ -z "${GITHUB_REPOSITORY}" ]]; then
echo -e "\e[31mName of this repository needs to be set in GITHUB_REPOSITORY."
echo -e "\e[31mShould be in the form OWNER/REPO, for example:"
echo -e "\e[31m ponylang/ponyup"
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

if [[ -z "${APPLICATION_NAME}" ]]; then
echo -e "\e[31mAPPLICATION_NAME needs to be set."
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

if [[ -z "${APPLICATION_SUMMARY}" ]]; then
echo -e "\e[31mAPPLICATION_SUMMARY needs to be set."
echo -e "\e[31mIt's a short description of the application that will appear in Cloudsmith."
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

Expand All @@ -55,7 +56,7 @@ if [[ -z "${CLOUDSMITH_REPO}" ]]; then
echo -e "\e[31mShould be one of:"
echo -e "\e[35m nightlies"
echo -e "\e[35m releases"
echo -e "\e[31mExiting."
echo -e "\e[31mExiting.\e[0m"
exit 1
fi

Expand Down Expand Up @@ -92,18 +93,18 @@ ASSET_SUMMARY="${APPLICATION_SUMMARY}"
ASSET_DESCRIPTION="https://github.com/${GITHUB_REPOSITORY}"

# Build application installation
echo -e "\e[34mBuilding ${APPLICATION_NAME}..."
echo -e "\e[34mBuilding ${APPLICATION_NAME}...\e[0m"
make install prefix="${BUILD_DIR}" arch=${ARCH} \
version="${APPLICATION_VERSION}" static=true linker=bfd

# Package it all up
echo -e "\e[34mCreating .tar.gz of ${APPLICATION_NAME}..."
echo -e "\e[34mCreating .tar.gz of ${APPLICATION_NAME}...\e[0m"
pushd "${BUILD_PREFIX}" || exit 1
tar -cvzf "${ASSET_FILE}" *
popd || exit 1

# Ship it off to cloudsmith
echo -e "\e[34mUploading package to cloudsmith..."
echo -e "\e[34mUploading package to cloudsmith...\e[0m"
cloudsmith push raw --version "${CLOUDSMITH_VERSION}" \
--api-key "${CLOUDSMITH_API_KEY}" --summary "${ASSET_SUMMARY}" \
--description "${ASSET_DESCRIPTION}" ${ASSET_PATH} "${ASSET_FILE}"