-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsemver.bash
41 lines (34 loc) · 973 Bytes
/
semver.bash
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
35
36
37
38
39
40
41
#! /bin/bash
packages=('access-control' 'access-control-front' 'http-client-front')
if [ "$1" ]; then
package=$1
else
echo "First parameter (package) is required" && exit
fi
if [ "$2" ]; then
type=$2
else
type='release'
fi
if [ $type == 'release' ]; then
release='release'
elif [ $type == 'patch' ] || [ $type == 'major' ] || [ $type == 'minor' ]; then
release="release:$type"
else
echo "Flag t should be (major | minor | patch)" && exit
fi
exist='no'
for value in ${packages[@]}
do
if [ $package == $value ]; then
exist='yes'
break
fi
done
if [ $exist == 'no' ]; then
echo "Library $package doesn't exist in array of packages inside semver.bash" && exit
fi
cd "./packages/$package" && npm run $release -- -t=$package.v && \
cd "../.." && npx nx build $package && cd "./dist/packages/$package" && \
npm publish --access public && cd "../.." && git push --tags && \
echo "Library $package updated with semver, builded and uploaded in npm"