Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 72e47e0

Browse files
committed
add script to check version
1 parent 782f41f commit 72e47e0

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
set -x
4+
# force a failure if there's no tag
5+
git describe --tags
6+
# now get the tag
7+
CURRENT_TAG=$(git describe --tags | cut -f2 -dv)
8+
# convert v0.2.12-2-g50254a9 to 0.2.12
9+
CURRENT_TAG_VERSION=$(git describe --tags | cut -f1 -d'-' | cut -f2 -dv)
10+
# if there's a hash on the tag, then this is not a release tagged commit
11+
if [ "$CURRENT_TAG" != "$CURRENT_TAG_VERSION" ]; then
12+
echo "Current tag version is not a release tag, cut a new release if you want to publish."
13+
exit 1
14+
fi
15+
16+
if python3 -m pip install --no-cache-dir -vvv AWSIoTPythonSDK==$CURRENT_TAG_VERSION; then
17+
echo "$CURRENT_TAG_VERSION is already in pypi, cut a new tag if you want to upload another version."
18+
exit 1
19+
fi
20+
21+
echo "$CURRENT_TAG_VERSION currently does not exist in pypi, allowing pipeline to continue."
22+
exit 0
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 0.2
2+
#this build spec assumes the ubuntu 14.04 trusty image
3+
#this build run simply verifies we haven't published something at this tag yet.
4+
#if we have we fail the build and stop the pipeline, if we haven't we allow the pipeline to run.
5+
phases:
6+
install:
7+
commands:
8+
- sudo apt-get update -y
9+
- sudo apt-get install python3 python3-pip -y
10+
- pip3 install --upgrade setuptools
11+
pre_build:
12+
commands:
13+
build:
14+
commands:
15+
- echo Build started on `date`
16+
- cd aws-iot-device-sdk-python
17+
- bash ./continuous-delivery/test_version_exists
18+
post_build:
19+
commands:
20+
- echo Build completed on `date`
21+

0 commit comments

Comments
 (0)