Skip to content

Commit 2d673cc

Browse files
author
Justin Boswell
authored
Moved version update to a script because YAML is mad (#46)
1 parent fadc777 commit 2d673cc

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

continuous-delivery/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ phases:
1010
commands:
1111
- cd $CODEBUILD_SRC_DIR/aws-iot-device-sdk-js-v2
1212
- aws secretsmanager get-secret-value --secret-id prod/npm-registry/.npmrc --region us-east-1 | jq -r .SecretString > .npmrc
13-
- sed --in-place -E "s/\"version\":: \".+\"/\"version\":: \"${PKG_VERSION}\"/" package.json
13+
- ./update-version.sh
1414
- npm install
1515
- npm pack
1616
- npm --userconfig ./.npmrc publish aws-iot-device-sdk-v2*.tgz
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
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+
sed --in-place -E "s/\"version\": \".+\"/\"version\": \"${PKG_VERSION}\"/" package.json
17+
18+
exit 0

0 commit comments

Comments
 (0)