-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
publish-package.sh
executable file
·41 lines (29 loc) · 1.09 KB
/
publish-package.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
#!/bin/sh
set -e
CURRENT_BRANCH=`git name-rev --name-only HEAD`
if [ $CURRENT_BRANCH != 'master' ] ; then
echo "Build not on master. Skipped pushing to chosen-package"
exit 0
fi
CHOSEN_VERSION=`git tag --sort=v:refname | tail -1`
GITHUB_URL=https://pfiller:${GH_TOKEN}@github.com/harvesthq/chosen-package.git
git clone $GITHUB_URL
rm -rf chosen-package/*
cp README.md public/*.json public/*.png public/*.js public/*.css public/LICENSE* chosen-package/
cp package-travis.yml chosen-package/.travis.yml
cd chosen-package
git config user.email "[email protected]"
git config user.name "chosen-package"
LATEST_VERSION=`git tag --sort=v:refname | tail -1`
git remote set-url origin $GITHUB_URL
git add -A
git commit -m "Chosen build to chosen-package"
if [ "$LATEST_VERSION" = "$CHOSEN_VERSION" ] ; then
echo "No Chosen version change. Skipped tagging"
else
echo "Chosen version changed. Tagging version ${CHOSEN_VERSION}\n"
git tag -a "${CHOSEN_VERSION}" -m "Version ${CHOSEN_VERSION}"
fi
git push origin master
git push origin --tags
echo "Chosen built and pushed to harvesthq/chosen-package"