-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-release.sh
executable file
·52 lines (41 loc) · 1020 Bytes
/
create-release.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
ARGS=( \
APP \
VERSION \
)
################################################################################
# Validate and extract arguments
################################################################################
display_usage() {
echo -e "\nUsage:\n${0} ${ARGS[*]}\n"
}
if [[ $# -ne ${#ARGS[@]} ]]
then
display_usage
exit 1
fi
ARG_VALUES=("$@")
PARAMS=()
for index in ${!ARGS[*]}; do
declare "${ARGS[$index]}"="${ARG_VALUES[$index]}"
done
branch_name=$(git symbolic-ref -q HEAD)
branch_name=${branch_name##refs/heads/}
branch_name=${branch_name:-HEAD}
if [ $branch_name != "main" ]
then
echo "You must create release from main branch (current: $branch_name)"
exit 1
fi
if [ ! -d "./packages/$APP" ]; then
echo "$APP does not exist. Apps available:"
for dir in packages/*/; do basename "$dir"; done
exit 1
fi
echo "Creating release of $APP for version $VERSION"
echo $VERSION $APP
npx nx release changelog \
-i "all" \
-p $APP \
--from develop \
${VERSION}