Skip to content

Commit

Permalink
Nest everything in if statement and revert version
Browse files Browse the repository at this point in the history
  • Loading branch information
abarciauskas-bgse committed Feb 1, 2018
1 parent 3dee3a5 commit 9450ced
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
34 changes: 20 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,28 @@ jobs:
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
VERSION=`awk -F\' '{print $2,$4}' message_adapter/version.py`
# Only tag and release if the version doesn't already exist
if [ -z $(git ls-remote --tags origin | grep $VERSION) ]; then
git tag $VERSION
git push origin $VERSION
DATA=$(echo '{"tag_name": "'$VERSION'"}' | tr -d '[:space:]')
curl -X POST -u cumulusgit:$CUMULUSGIT_GITHUB_API_ACCESS_TOKEN \
https://api.github.com/repos/cumulus-nasa/cumulus-message-adapter/releases \
--data $DATA
git tag $VERSION
echo "Pushing tag ${VERSION}"
git push origin $VERSION
# strip white space from create release request body
CREATE_RELEASE_REQUEST_BODY=$(echo '{"tag_name": "'$VERSION'", "name": "'$VERSION'"}' | tr -d '[:space:]')
echo "Creating release for tag ${VERSION}"
curl -X POST -u cumulusgit:$CUMULUSGIT_GITHUB_API_ACCESS_TOKEN \
https://api.github.com/repos/cumulus-nasa/cumulus-message-adapter/releases \
--data $CREATE_RELEASE_REQUEST_BODY | jq .
echo "Building cumulus-message-adapter.zip"
make clean
make cumulus-message-adapter.zip
UPLOAD_URL_TEMPLATE=$(curl https://api.github.com/repos/cumulus-nasa/cumulus-message-adapter/releases/tags/$VERSION | jq '.upload_url' --raw-output)
UPLOAD_URL=${UPLOAD_URL_TEMPLATE//{?name,label\}/?name=cumulus-message-adapter.zip}
echo "Uploading release to ${UPLOAD_URL}"
curl -X POST -u cumulusgit:$CUMULUSGIT_GITHUB_API_ACCESS_TOKEN \
-H "Content-Type: application/zip" \
$UPLOAD_URL \
--data-binary @./cumulus-message-adapter.zip | jq .
fi
make clean
make cumulus-message-adapter.zip
UPLOAD_URL_TEMPLATE=$(curl https://api.github.com/repos/cumulus-nasa/cumulus-message-adapter/releases/tags/$VERSION | jq '.upload_url' --raw-output)
UPLOAD_URL=${UPLOAD_URL_TEMPLATE//{?name,label\}/?name=cumulus-message-adapter.zip}
curl -X POST -u cumulusgit:$CUMULUSGIT_GITHUB_API_ACCESS_TOKEN \
-H "Content-Type: application/zip" \
$UPLOAD_URL \
--data-binary @./cumulus-message-adapter.zip
workflows:
version: 2
Expand Down
2 changes: 1 addition & 1 deletion message_adapter/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = 'v0.0.3'
__version__ = 'v0.0.2'

0 comments on commit 9450ced

Please sign in to comment.