forked from passingthru67/workspaces-to-dock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_release
executable file
·100 lines (85 loc) · 2.89 KB
/
build_release
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
# usage: build_release [OPTION]
# creates zip in attic/releases/master/<version_number>
# <version_number> found in metadata.json
#
# options:
# -d creates zip in root
#
APPLICATION="${0##*/}"
USAGE="$APPLICATION [options] version_number
Builds the installation zip for release and copies it into the releases folder.
Options:
-d Zip file will be copied into the development branch instead of the releases folder.
"
## Verify argument for version_number exists
#if [ $# -lt 1 ] ;
#then
#echo "Cannot build without a release number. Replace <version_number> with an integer value."
#echo ""
#echo "$USAGE"
#exit 1
#fi
## Test to verify argument is integer
#if [[ $1 != [0-9]* ]];
#then
#echo "$USAGE"
#exit 1
#fi
# Process options
while getopts "d" flag; do
case "$flag" in
d) DEV='y';;
*) echo "$USAGE"; exit 1;;
esac
done
shift $((OPTIND-1))
# Set directory variables
#root_dir=~/.local/share/gnome-shell/extensions/workspaces-to-dock
root_dir=${PWD}
files_dir=$root_dir/[email protected]
temp_dir=$root_dir/attic/releases/build
# Create temp directory
rm -Rf "$temp_dir"
mkdir -p "$temp_dir"
# Copy extension files stripping out debug
cd "$files_dir"
#sed "s/ 0/ $1/g" metadata.json > "$temp_dir/metadata.json"
cat metadata.json > "$temp_dir/metadata.json"
cat convenience.js | grep -v '_DEBUG_' > "$temp_dir/convenience.js"
cat dockedWorkspaces.js | grep -v '_DEBUG_' > "$temp_dir/dockedWorkspaces.js"
cat extension.js | grep -v '_DEBUG_' > "$temp_dir/extension.js"
cat intellihide.js | grep -v '_DEBUG_' > "$temp_dir/intellihide.js"
cat myPressureBarrier.js | grep -v '_DEBUG_' > "$temp_dir/myPressureBarrier.js"
cat myWorkspaceSwitcherPopup.js | grep -v '_DEBUG_' > "$temp_dir/myWorkspaceSwitcherPopup.js"
cat myWorkspaceThumbnail.js | grep -v '_DEBUG_' > "$temp_dir/myWorkspaceThumbnail.js"
cat placeDisplay.js | grep -v '_DEBUG_' > "$temp_dir/placeDisplay.js"
cat prefs.js | grep -v '_DEBUG_' > "$temp_dir/prefs.js"
cat shortcutsPanel.js | grep -v '_DEBUG_' > "$temp_dir/shortcutsPanel.js"
cat thumbnailCaption.js | grep -v '_DEBUG_' > "$temp_dir/thumbnailCaption.js"
# Copy extension subfolders
cp -R schemas/ "$temp_dir/"
cp -R themes/ "$temp_dir/"
cp -R locale/ "$temp_dir/"
# Create release zip
cd "$temp_dir/"
zip -r [email protected] *
# Set release_dir based on development option and metadata version number
version_number=$(grep \"version\": metadata.json | awk '{print $2}')
if [ -z "$DEV" ];
then
release_dir=$root_dir/attic/releases/master/$version_number
else
release_dir=$root_dir
fi
# Delete and recreate release directory
if [ -z "$DEV" ];
then
rm -Rf "$release_dir"
mkdir -p "$release_dir"
fi
# Copy zip file to release directory
cp [email protected] "$release_dir/"
# Cleanup - remove temp directory
rm -Rf "$temp_dir"
echo "Build completed."