forked from guardian/scribe
-
Notifications
You must be signed in to change notification settings - Fork 2
/
release.sh
executable file
·42 lines (34 loc) · 976 Bytes
/
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
#!/bin/bash
BASE_DIR=$(dirname $0)
if [ $# -ne 1 ];
then
echo "Usage: ./release.sh <version-number | major | minor | patch | build>"
exit 1
fi
# Clean the working tree
git reset --hard
git checkout master
echo "-- Building distribution files"
npm run build
echo "-- Copying distribution files to dist branch"
git checkout dist
git fetch
git reset --hard origin/dist
yes | cp ./build/* .
git diff --name-only | if (grep "\.js$" | grep -v "\.min\.js$")
then
echo "-- Commiting update to distribution files"
git add --update .
git commit --message "Update distribution files"
MVERSION_PATH="$BASE_DIR/node_modules/.bin/mversion"
echo "-- Current version: `$MVERSION_PATH`"
echo "-- Updating version"
$MVERSION_PATH $1 -m "v%s
[ci skip]"
echo "-- Check the commit worked and then push (dist branch and new tag)"
else
echo "-- No updates to be committed"
# Clean the working tree
git reset --hard
fi
git checkout master