Skip to content

Commit f6f684e

Browse files
author
Kenny Evitt
committed
Guard publish task with option
Issue kriskbx#33
1 parent 6c81818 commit f6f684e

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

build.sh

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,50 @@
11
#!/bin/bash
22

3+
4+
5+
# Adapted from:
6+
#
7+
# - [How can I handle command-line options and arguments in my script easily? - BashFAQ/035 - Greg's Wiki](http://mywiki.wooledge.org/BashFAQ/035)
8+
9+
die() {
10+
printf '%s\n' "$1" >&2
11+
exit 1
12+
}
13+
14+
# Initialize all the option variables.
15+
# This ensures we are not contaminated by variables from the environment.
16+
should_publish=false
17+
18+
while :; do
19+
case $1 in
20+
--publish)
21+
should_publish=true
22+
;;
23+
--) # End of all options
24+
shift
25+
break
26+
;;
27+
-?*)
28+
message=$(printf 'ERROR: Unknown option: %s\n' "$1")
29+
die "$message"
30+
;;
31+
*) # Default case: No more options, so break out of the loop.
32+
break
33+
esac
34+
35+
shift
36+
done
37+
38+
39+
340
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
441
export DISPLAY=:99.0
542
export DEBUG=electron-installer-snap:snapcraft
643
sleep 5
744

845
yarn install --force
946
yarn run production
10-
yarn run publish
47+
48+
if [[ "$should_publish" = true ]]; then
49+
yarn run publish
50+
fi

0 commit comments

Comments
 (0)