-
Notifications
You must be signed in to change notification settings - Fork 4
/
buildspec.yml
28 lines (27 loc) · 1.01 KB
/
buildspec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
version: 0.2
phases:
install:
runtime-versions:
nodejs: 12
commands:
- npm install
- yum update -y && yum install -y jq
pre_build:
commands:
- npm run lint
- npm run test
build:
commands:
- echo 'Verifying npm publish is required'
- CURRENT_PUBLISHED_VERSION=$(npm info adjs version)
- if [ -z $CURRENT_PUBLISHED_VERSION ]; then echo "Could not find latest published version. Exiting build."; exit 1; fi
- LOCAL_VERSION=$(cat package.json | jq '.version' | tr -d '"' | tr -d '\n')
- if [ -z $LOCAL_VERSION ]; then echo "Version is missing from package.json. Exiting build."; exit 1; fi
- |
set -e
if [ $LOCAL_VERSION = $CURRENT_PUBLISHED_VERSION ]; then
echo "Version is unchanged. NPM publish is not required."
else
echo "New version detected. Publishing to NPM."
NPM_TOKEN=$(aws ssm get-parameter --name npm-publish-token --with-decryption | jq '.Parameter.Value') npm run release
fi