Skip to content

Commit

Permalink
Merge pull request #38 from DanMad/develop
Browse files Browse the repository at this point in the history
Beautified Shell commands
  • Loading branch information
DanMad authored Jul 21, 2021
2 parents 1bc406b + c0cce45 commit 8f54919
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
8 changes: 7 additions & 1 deletion .github/check-package-version
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

PACKAGE_VERSION=$(cat package.json | jq -r .version)
GITHUB_ENDPOINT="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/git/ref/tags/v${PACKAGE_VERSION}"
GITHUB_ENDPOINT_STATUS=$(curl -LI $GITHUB_ENDPOINT -o /dev/null -w '%{http_code}\n' -sH "Authorization: token ${GITHUB_TOKEN}")
GITHUB_ENDPOINT_STATUS=$(
curl \
-LI $GITHUB_ENDPOINT \
-o /dev/null \
-w '%{http_code}\n' \
-sH "Authorization: token ${GITHUB_TOKEN}" \
)

if [ "$GITHUB_ENDPOINT_STATUS" = "404" ]
then
Expand Down
13 changes: 12 additions & 1 deletion .github/create-github-release
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,22 @@ PAYLOAD="{ \
\"prerelease\": false \
}"
GITHUB_ENDPOINT="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases"
GITHUB_ENDPOINT_STATUS=$(curl -H "Content-Type:application/json" $GITHUB_ENDPOINT -o /dev/null -w '%{http_code}\n' -d "${PAYLOAD}" -sH "Authorization: token ${GITHUB_TOKEN}")
GITHUB_ENDPOINT_STATUS=$(
curl \
-H "Content-Type:application/json" $GITHUB_ENDPOINT \
-o /dev/null \
-w '%{http_code}\n' \
-d "${PAYLOAD}" \
-sH "Authorization: token ${GITHUB_TOKEN}" \
)

if [ "$GITHUB_ENDPOINT_STATUS" = "201" ]
then
echo "This version was released"
elif [ "$GITHUB_ENDPOINT_STATUS" = "404" ]
then
echo "This version wasn't released"
exit 1
else
echo "There was a problem connecting to GitHub"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "on-the-case",
"version": "1.1.7",
"version": "1.1.8",
"description": "A module that extends JavaScript's String object with additional case-conversion support",
"homepage": "https://www.npmjs.com/package/on-the-case",
"bugs": "https://github.com/DanMad/on-the-case/issues",
Expand Down

0 comments on commit 8f54919

Please sign in to comment.