From 5ea99b4c0694b46d6a832a33d710b5f57860d3a4 Mon Sep 17 00:00:00 2001 From: Ryan Faircloth <35384120+rfaircloth-splunk@users.noreply.github.com> Date: Sat, 13 Feb 2021 18:19:28 -0500 Subject: [PATCH] fix: Minor fix release (#50) * fix: Publish Release notes --- .circleci/config.yml | 20 +------------------- .circleci/publish.sh | 36 ++++++++++++++++++++++++++++++++++++ .releaserc.json | 12 ++---------- CHANGELOG.md | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 29 deletions(-) create mode 100755 .circleci/publish.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 7e975c96..6a5d38d5 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -69,6 +69,7 @@ jobs: pip install pip --upgrade pip install -r requirements_dev.txt --use-deprecated=legacy-resolver || true pip install semantic_version==2.6.0 + pip install git+https://github.com/pixelb/crudini sudo apt install npm - run: @@ -473,25 +474,6 @@ jobs: command: | npx semantic-release - publish-gh: - docker: - - image: circleci/python:3.7 - steps: - - setup_remote_docker: - docker_layer_caching: true - - attach_workspace: - at: /tmp/workspace - - checkout - - go/install - - run: - name: "Publish on GitHub" - command: | - PATH=$PATH:/usr/local/go/bin - go get -v -u github.com/tcnksm/ghr - [[ << pipeline.git.tag >> =~ ^v[0-9]*.[0-9]*.[0-9]*$ ]] || export ISPRE=-prerelease - $HOME/go/bin/ghr -t ${GH_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${ISPRE} -delete "<< pipeline.git.tag >>" /tmp/workspace/build/package/splunkbase - $HOME/go/bin/ghr -t ${GH_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${ISPRE} "<< pipeline.git.tag >>" /tmp/workspace/build/package/deployment - publish-sbase: docker: - image: circleci/python:3.7 diff --git a/.circleci/publish.sh b/.circleci/publish.sh new file mode 100755 index 00000000..6870def6 --- /dev/null +++ b/.circleci/publish.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +source .splunkbase +source ~/.venv/bin/activate +PACKAGE=$(ls build/package/splunkbase/*) +PACKAGE_ID=$(crudini --get package/default/app.conf id name) +[[ $1 =~ ^v[0-9]*.[0-9]*.[0-9]*$ ]] || export ISPRE=-prerelease +SPLUNKBASE_VERSION=$(echo $1 | sed 's/^v//' | sed 's/-develop./develop/g') +echo publish $SPLUNKBASE_VERSION +[ "${ISPRE}" == "-prerelease" ] && SPLUNKBASE_VIS="false" || SPLUNKBASE_VIS="true" +echo uploading package +BASE=https://splunkbase.splunk.com/api/v0.1/app/${SPLUNKBASE_ID}/release/ +echo $BASE + + curl -u ${SPLUNKBASE_USERNAME}:${SPLUNKBASE_PASSWORD} \ + --request POST https://splunkbase.splunk.com/api/v1/app/${SPLUNKBASE_ID}/new_release/ \ + -F "files[]=@${PACKAGE}" -F "filename=${PACKAGE_ID}.spl" \ + -F "splunk_versions=${SPLUNKBASE_SPLUNK_VERSION}" \ + -F "visibility=${SPLUNKBASE_VIS}" + sleep 30 + ITEM=$(curl -u ${SPLUNKBASE_USERNAME}:${SPLUNKBASE_PASSWORD} \ + --request GET $BASE \ + | jq ".[] | select(.name==\"$SPLUNKBASE_VERSION\") | .id") + + echo get $ITEM + CURRENT=$(curl -u ${SPLUNKBASE_USERNAME}:${SPLUNKBASE_PASSWORD} \ + --request GET $BASE${ITEM}/ \ + | jq ) + + NOTES=$(cat CHANGELOG.md | jq -sR) + NEW=$(echo $CURRENT | jq ".release_notes = $NOTES" | jq -c) + curl -u ${SPLUNKBASE_USERNAME}:${SPLUNKBASE_PASSWORD} \ + --location \ + --request PUT $BASE${ITEM}/ \ + --header 'Content-Type: application/json' \ + --data-raw "$NEW" | jq + diff --git a/.releaserc.json b/.releaserc.json index bd0030fa..6c904d81 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -27,19 +27,11 @@ "addReleases": "top" } ], - [ - "@semantic-release/git", - { - "assets": [ - "CHANGELOG.md" - ], - "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" - } - ], [ "@semantic-release/exec", { - "prepareCmd": ".circleci/package_release.sh ${nextRelease.version}" + "prepareCmd": ".circleci/package_release.sh ${nextRelease.version}", + "publishCmd": ".circleci/publish.sh ${nextRelease.version}" } ] ] diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f03df25..6ab4307d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,38 @@ +## [6.0.9-develop.5](https://github.com/splunk/seckit_sa_geolocation/compare/v6.0.9-develop.4...v6.0.9-develop.5) (2021-02-12) + + +### Bug Fixes + +* timeout ([e42986a](https://github.com/splunk/seckit_sa_geolocation/commit/e42986acb15a4318fe42728434ac7a6dbc34b918)) + +## [6.0.9-develop.4](https://github.com/splunk/seckit_sa_geolocation/compare/v6.0.9-develop.3...v6.0.9-develop.4) (2021-02-12) + + +### Bug Fixes + +* venv ([bf30852](https://github.com/splunk/seckit_sa_geolocation/commit/bf30852eecbceabc50c14b11639008f421fcf3e6)) + +## [6.0.9-develop.3](https://github.com/splunk/seckit_sa_geolocation/compare/v6.0.9-develop.2...v6.0.9-develop.3) (2021-02-12) + + +### Bug Fixes + +* shebang ([61b73c5](https://github.com/splunk/seckit_sa_geolocation/commit/61b73c53c3f1012ad1cf3f642977cf54304c6d37)) + +## [6.0.9-develop.2](https://github.com/splunk/seckit_sa_geolocation/compare/v6.0.9-develop.1...v6.0.9-develop.2) (2021-02-12) + + +### Bug Fixes + +* missing crud ini ([393e5bc](https://github.com/splunk/seckit_sa_geolocation/commit/393e5bcda04e94523ff6e8b06d59a799950db628)) + +## [6.0.9-develop.1](https://github.com/splunk/seckit_sa_geolocation/compare/v6.0.8...v6.0.9-develop.1) (2021-02-12) + + +### Bug Fixes + +* Publish Release notes ([fafe1bf](https://github.com/splunk/seckit_sa_geolocation/commit/fafe1bf29893ac9542f0016220fe39fb0e40e902)) + ## [6.0.8](https://github.com/splunk/seckit_sa_geolocation/compare/v6.0.7...v6.0.8) (2021-02-12)