Last active
May 18, 2021 10:12
-
-
Save kikyous/1694475e163782696500049927f00704 to your computer and use it in GitHub Desktop.
lms_post_build.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COMMIT_MSG=$(git log -1 --pretty=%s) | |
VERSION=$(python lms/version.py) | |
function record_version { | |
if [[ -z "$HIPA_TOKEN" ]]; then | |
echo "Must provide HIPA_TOKEN in environment" 1>&2 | |
else | |
curl -X POST 'https://api.hipacloud.com/v1/apps/609e18e9bdd6c63429bb80d2/tables/609e18e9bdd6c63429bb80d3/records' \ | |
-H "Authorization: Bearer $HIPA_TOKEN" \ | |
-H "Content-Type: application/json" \ | |
--data "{ | |
\"values\": { | |
\"VERSION\": \"$VERSION\", | |
\"PIPLINE\": \"$GO_PIPELINE_NAME\", | |
\"COMMIT MSG\": \"$COMMIT_MSG\" | |
} | |
}" | |
fi | |
} | |
function notify_wechat { | |
if [[ -z "$WECHAT_HOOK" ]]; then | |
echo "Must provide WECHAT_HOOK in environment" 1>&2 | |
else | |
curl "$WECHAT_HOOK" \ | |
-H 'Content-Type: application/json' \ | |
-d "{ | |
\"msgtype\": \"text\", | |
\"text\": { | |
\"content\": \"$GO_PIPELINE_NAME 出包成功:$VERSION ($COMMIT_MSG)\" | |
} | |
}" | |
fi | |
} | |
record_version | |
notify_wechat | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment