-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·38 lines (29 loc) · 767 Bytes
/
deploy.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
#!/bin/bash
# exit if any command fails
set -e
DATE=`date +%Y.%m.%d`
git add .
git commit -m "Update @ $DATE"
LATEST_TAG=$(git describe --tags --abbrev=0)
CURRENT_REVISION=$(git describe)
NUMBER_FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG | wc -l)
FILES_CHANGED=$(git diff --name-only HEAD $LATEST_TAG)
if [ -z "$FILES_CHANGED" ]; then
echo Nothing changed since $LATEST_TAG
echo done.
exit
fi
if grep -qE '\bindex.js' <<< "$FILES_CHANGED"; then
yarn version --new-version $DATE --no-git-tag-version
git add index.js
git add package.json
git commit --no-edit --amend
git tag -a $DATE -m "$DATE"
npm publish
else
git commit --amend -m "Updated project files"
fi
git push --tags
git push --all
git lg -10
echo done.