forked from Schneegans/Fly-Pie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-release.sh
More file actions
executable file
·77 lines (62 loc) · 3.35 KB
/
create-release.sh
File metadata and controls
executable file
·77 lines (62 loc) · 3.35 KB
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
#!/bin/bash
# -------------------------------------------------------------------------------------- #
# ___ _ ___ #
# | | \/ | ) | | This software may be modified and distri- #
# O- |- | | - | | |- -O buted under the terms of the MIT license. #
# | |_ | | | |_ See the LICENSE file for details. #
# #
# -------------------------------------------------------------------------------------- #
# This script creates a new release of the Fly-Pie GNOME extension.
# When the '-i' option is set, it installs it to the system.
# When the '-s' option is set, the script throws an error (instead of just a warning) when the
# zip file is too big. This is necessary when uploading it to the GNOME Extensions website.
# We think that the limit is 4096 KB, but we found no official documentation on this so far.
# Exit the script when one command fails.
set -e
# Print usage info.
usage() {
echo "Use '-i' to install the extension to your system. To just build it, run the script without any flag."
echo "Use '-s' to throw an error when the zip size is too big to be uploaded to the Extensions website."
}
# Go to the repo root.
cd "$( cd "$( dirname "$0" )" && pwd )/.." || \
{ echo "ERROR: Could not find the repo root."; exit 1; }
echo "Compiling resources..."
cd resources && glib-compile-resources --generate flypie.gresource.xml && cd ..
echo "Compiling schemas..."
glib-compile-schemas schemas
echo "Compiling locales..."
scripts/compile-locales.sh
# Delete any old zip and pack everything together
rm --force flypie@schneegans.github.com.zip
zip -r flypie@schneegans.github.com.zip -- src presets resources/flypie.gresource schemas/gschemas.compiled locale *.js metadata.json LICENSE
while getopts is FLAG; do
case $FLAG in
i) # Install the extension, but only if this would not overwrite the git repository.
if ! [[ $(pwd) == *".local/share/gnome-shell/extensions/flypie@schneegans.github.com" ]]; then
# shellcheck disable=2015
gnome-extensions install flypie@schneegans.github.com.zip --force && \
echo "Extension installed successfully! Now restart the Shell ('Alt'+'F2', then 'r')." || \
{ echo "ERROR: Could not install the extension."; exit 1; }
else
echo "Skipping install step, the repo is already located in the extensions directory."
echo "Restart the Shell to get the updated version ('Alt'+'F2', then 'r')."
fi;;
s) # We need to throw an error because of the zip size
SIZE_ERROR="true";;
*) echo "ERROR: Invalid flag!"
usage
exit 1;;
esac
done
# Check zip file size
SIZE=$(stat -c %s flypie@schneegans.github.com.zip)
# If the zip is too big and a check is requested, throw an error. Otherwise just print a warning.
if [[ "$SIZE" -gt 4096000 ]]; then
if [ "$SIZE_ERROR" = "true" ]; then
echo "ERROR! The zip is too big to be uploaded to the Extensions website. Keep it smaller than 4096 KB!"
exit 2
else
echo "WARNING! The zip is too big to be uploaded to the Extensions website. Keep it smaller than 4096 KB!"
fi
fi