forked from onecx/onecx-portal-ui-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease-script.sh
executable file
·29 lines (25 loc) · 955 Bytes
/
release-script.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
#!/bin/bash
echo "$1"
export VERSION=$1
packageJsonData=$(cat package.json)
topLevelPackageVersion=$(echo "$packageJsonData" | jq -r '.version')
if [[ $topLevelPackageVersion != $1 ]]
then
npx -p replace-json-property rjp ./package.json version $1
fi
folder_names=()
directory="libs"
while IFS= read -r folder; do
folder_names+=("$folder")
done < <(find "$directory" -mindepth 1 -maxdepth 1 -type d | awk -F "/" '{print $NF}' | sort | uniq)
for folder in "${folder_names[@]}"; do
packageJsonDataLib=$(cat libs/$folder/package.json)
libPackageVersion=$(echo "$packageJsonDataLib" | jq -r '.version')
packageJsonDataLib=$(echo "$packageJsonDataLib" | sed -E 's/(@onecx[^"]+?": *?")([^"]+)"/\1^'$1'"/')
echo $packageJsonDataLib > libs/$folder/package.json
if [[ $libPackageVersion != $1 ]]
then
npx -p replace-json-property rjp libs/$folder/package.json version $1
npx nx run $folder:release
fi
done