forked from hyperledger/identus-edge-agent-sdk-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.sh
executable file
·34 lines (25 loc) · 915 Bytes
/
publish.sh
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
29
30
31
32
33
34
#!/bin/bash
set -e
if [ -z "$1" ]; then
echo "Error: Missing release_version parameter. Please check what happened."
exit 1
fi
release_version="$1"
# Updates the version to the release
npm version "$release_version" --git-tag-version false
# Generates the build
npm run build
# Gets the published versions in the registry
version_list=$(npm view @hyperledger/identus-edge-agent-sdk versions)
published_versions=${version_list//[\[\]]/}
# Checks if it's been already published to npmjs
if [[ ${published_versions[@]} =~ "'$release_version'" ]]; then
# The goal of this case is to enable the generation of semantic-release
# commits despite of the current version is already published.
# Usually this is due some error during the pipeline execution.
echo "$release_version is already published. Skipping publication."
else
npm publish --access public
fi
# Build docs
npm run docs