forked from OneSignal/OneSignal-WordPress-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_release.sh
executable file
·42 lines (34 loc) · 2.18 KB
/
build_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
# Note: Keep trailing slash to copy contents of dir, but not dir itself
WORDPRESS_GIT_SRC_PATH="."
DESTINATION_PATH="../onesignal-free-web-push-notifications/trunk/"
RELEASE_ARCHIVE_FILENAME="onesignal-free-web-push-notifications.zip"
# Prevent accidental rm -rf issues if running as root
if (( $EUID == 0 )); then
echo "Please do not run this script as root for removing directory safety reasons."
exit
fi
# Using exclude .* excludes dot files and dot directories like .git, .vscode
if [[ $DESTINATION_PATH != *onesignal-free-web-push-notifications/trunk/ ]]; then
echo "Script was going to remove ${DESTINATION_PATH}, but quitting because destination path unexpectedly does not end in ...onesignal-free-web-push-notifications/trunk/. Exiting to prevent removing unexpected directory."
exit
fi
echo "Building Release Version of OneSignal WordPress Plugin"
echo "──────────────────────────────────────────────────────"
echo ""
echo "Removing destination folder '${DESTINATION_PATH}'."
rm -rf $DESTINATION_PATH
echo "Creating new empty destination folder '${DESTINATION_PATH}'."
mkdir -p $DESTINATION_PATH
echo "Copying contents of source directory '${WORDPRESS_GIT_SRC_PATH}' to destination directory '${DESTINATION_PATH}'."
rsync --archive --exclude=".*" --exclude="build_release.sh" --exclude="*.zip" --exclude="onesignal-free-web-push-notifications" $WORDPRESS_GIT_SRC_PATH $DESTINATION_PATH
echo "Creating archive of release contents as '${RELEASE_ARCHIVE_FILENAME}' in source directory '${WORDPRESS_GIT_SRC_PATH}'."
last_dir=$(pwd)
cd ${WORDPRESS_GIT_SRC_PATH}
zip -qr -x ".*" -x="build_release.sh" -x="*.zip" -x="onesignal-free-web-push-notifications" ${RELEASE_ARCHIVE_FILENAME} ./*
cd $last_dir
rm ../onesignal-free-web-push-notifications/trunk/README.md
rm ../onesignal-free-web-push-notifications/trunk/index.php
rm ../onesignal-free-web-push-notifications/trunk/views/css/*.scss
rm ../onesignal-free-web-push-notifications/trunk/views/css/callout.css
rm ../onesignal-free-web-push-notifications/trunk/views/css/link.css
rm -r ../onesignal-free-web-push-notifications/trunk/views/css/semantic-ui