github.com/klaytn/klaytn@v1.12.1/.circleci/scripts/build_announce.sh (about)

     1  #!/usr/bin/env bash
     2  set -euox
     3  
     4  VERSION=$(go run build/rpm/main.go version)~${CIRCLE_TAG##*-}
     5  
     6  SHORT_SHA1=${CIRCLE_SHA1:0:7}
     7  CIRCLE_PR=$(hub pr list -s open -L 10 -f "%I %sH %n" | grep $CIRCLE_SHA1)
     8  CIRCLE_PR_NUMBER=${CIRCLE_PR%% *}
     9  
    10  PACKAGES="kcn kpn ken kscn kspn ksen kbn kgen homi"
    11  BAOBAB_PACKAGES="kcn kpn ken"
    12  PACKAGE_PREFIX="http://packages.klaytn.net/klaytn/${VERSION}"
    13  
    14  LINUX_PACKAGE_LINKS=""
    15  DARWIN_PACKAGE_LINKS=""
    16  BAOBAB_LINUX_PACKAGE_LINKS=""
    17  BAOBAB_DARWIN_PACKAGE_LINKS=""
    18  
    19  for i in ${PACKAGES}
    20  do
    21      LINUX_PACKAGE_LINKS+="<a href="${PACKAGE_PREFIX}/$i-${VERSION}-0-linux-amd64.tar.gz">$i</a>"
    22      LINUX_PACKAGE_LINKS+=" "
    23      DARWIN_PACKAGE_LINKS+="<a href="${PACKAGE_PREFIX}/$i-${VERSION}-0-darwin-10.10-amd64.tar.gz">$i</a>"
    24      DARWIN_PACKAGE_LINKS+=" "
    25  done
    26  
    27  for i in ${BAOBAB_PACKAGES}
    28  do
    29      BAOBAB_LINUX_PACKAGE_LINKS+="<a href="${PACKAGE_PREFIX}/$i-baobab-${VERSION}-0-linux-amd64.tar.gz">$i</a>"
    30      BAOBAB_LINUX_PACKAGE_LINKS+=" "
    31      BAOBAB_DARWIN_PACKAGE_LINKS+="<a href="${PACKAGE_PREFIX}/$i-baobab-${VERSION}-0-darwin-10.10-amd64.tar.gz">$i</a>"
    32      BAOBAB_DARWIN_PACKAGE_LINKS+=" "
    33  done
    34  
    35  COMMENT_ROWS="<ul><li>Linux: ${LINUX_PACKAGE_LINKS}</li><li>Darwin: ${DARWIN_PACKAGE_LINKS}</li><li>Baobab-linux: ${BAOBAB_LINUX_PACKAGE_LINKS}</li><li>Baobab-darwin: ${BAOBAB_DARWIN_PACKAGE_LINKS}</li></ul>"
    36  
    37  COMMENT_HEAD="Builds ready [${SHORT_SHA1}]"
    38  COMMENT_BODY="<details><summary>${COMMENT_HEAD}</summary>${COMMENT_ROWS}</details>"
    39  
    40  POST_COMMENT_URI="https://api.github.com/repos/klaytn/klaytn/issues/${CIRCLE_PR_NUMBER}/comments"
    41  
    42  curl -i --request POST ${POST_COMMENT_URI} \
    43  -H 'Content-Type: application/json' \
    44  -H 'User-Agent: klaytnbot' \
    45  -H 'Authorization: token '"${GITHUB_TOKEN}"'' \
    46  --data '{"body": "'"${COMMENT_BODY}"'"}'