-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_release_notes.sh
executable file
·43 lines (42 loc) · 1.4 KB
/
create_release_notes.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
#!/bin/bash
FILE_NAME=release_notes.properties
#
if [ -f "$PWD/$FILE_NAME" ]
then
echo "➡️ $FILE_NAME file exists."
# Check if DESCRIPTION exists in release notes file
DESCRIPTION=$(grep -iR "^DESCRIPTION" "$FILE_NAME" | awk -F "=" '{print $2}')
#
if [ -z "$DESCRIPTION" ]
then
echo "➡️ Invalid or empty DESCRIPTION ⚠️"
echo "➡️ Writing DESCRIPTION key to $FILE_NAME file..."
if echo -e "DESCRIPTION=$DESCRIPTION" >> $FILE_NAME; then
echo "✅ DESCRIPTION key written successfully, please remember to update the DESCRIPTION value."
read -n1 -s -r -p $'➡️ Press any key to exit \n' key
echo "Thank you."
else
echo -e "\033[0;31m🚫 Failed to write DESCRIPTION key to $FILE_NAME!"
fi
else
# DESCRIPTION key exists >> Close script.
exit 0
fi
else
echo "➡️ $FILE_NAME file does not exist ⚠️"
echo "➡️ Creating $FILE_NAME file..."
if touch $FILE_NAME;
then
echo "✅ $FILE_NAME created successfully."
echo "➡️ Writing DESCRIPTION key to $FILE_NAME file..."
if echo -e "DESCRIPTION=$DESCRIPTION" >> $FILE_NAME; then
echo "✅ DESCRIPTION key written successfully, please remember to update the DESCRIPTION value."
read -n1 -s -r -p $'➡️ Press any key to exit \n' key
echo "Thank you."
else
echo -e "\033[0;31m🚫 Failed to write DESCRIPTION key to $FILE_NAME!"
fi
else
echo "🚫 Failed ot create $SECRETS_FILE_NAME!"
fi
fi