generated from dalelane/scratch-extension-development
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4-publish.sh
executable file
·55 lines (46 loc) · 1.19 KB
/
4-publish.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
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
set -e
echo "Verifying location of Scratch source is known"
if [ -z "$SCRATCH_SRC_HOME" ]; then
echo "Error: SCRATCH_SRC_HOME environment variable is not set."
exit 1
fi
echo "Checking that Scratch has been patched"
if [ ! -f "$SCRATCH_SRC_HOME/patched" ]; then
echo "Scratch has not yet been patched. Run ./0-setup.sh"
exit 1
fi
# allow this script to be run from other locations, despite the
# relative file paths used in it
if [[ $BASH_SOURCE = */* ]]; then
cd -- "${BASH_SOURCE%/*}/" || exit
fi
echo "Commit any changes"
git add your-scratch-extension
git add dependencies
git commit -m "Update"
git push origin master
echo "Building the Scratch fork"
./2-build.sh
echo "Preparing a gh-pages branch"
DEVBRANCH=$(git rev-parse --abbrev-ref HEAD)
if git rev-parse --verify gh-pages >/dev/null 2>&1
then
git checkout gh-pages
else
git checkout -b gh-pages
fi
echo "Preparing a publish folder"
if [ -d "scratch" ]
then
rm -rf ./scratch/*
else
mkdir scratch
fi
echo "Publishing the Scratch fork"
cp -rf $SCRATCH_SRC_HOME/scratch-gui/build/* ./scratch/.
git add scratch
git commit -m "Update"
git push origin gh-pages
echo "Returning to dev branch"
git checkout $DEVBRANCH