This repository was archived by the owner on Aug 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
50 lines (45 loc) · 1.55 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
echo "Starting deploy script"
run () {
if [ -z "$CI" ]; then
echo "This commit would run '$1'"
else
echo "Checking out $TRAVIS_BRANCH"
git checkout $TRAVIS_BRANCH
if [ $TRAVIS_COMMIT == `git rev-parse HEAD` ]; then
echo "Resetting to $TRAVIS_COMMIT"
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
git update-index --skip-worktree .npmrc
git reset --hard $TRAVIS_COMMIT
git config --global user.email "[email protected]"
git config --global user.name "Levertion (via CI)"
# Silence it to not expose the GH_TOKEN
git remote set-url origin "https://Levertion:[email protected]/$TRAVIS_REPO_SLUG"
# Setup pushing of docs
git clone --no-checkout "https://Levertion:[email protected]/$TRAVIS_REPO_SLUG" docs
(
cd docs
git checkout origin/gh-pages
git checkout --orphan gh-pages-orphan
)
eval $1
(
cd docs
git add .
git commit -m "Update docs"
git push --force origin gh-pages-orphan:gh-pages
)
echo "Checking out $TRAVIS_COMMIT"
git checkout $TRAVIS_COMMIT --quiet
else
echo "Not on latest $TRAVIS_BRANCH, not pushing"
fi
fi
}
if [[ `git log -1 --pretty=%B` != "Publish"* ]]; then
run "npx lerna publish --conventional-prerelease --yes --dist-tag=master"
else
if [[ "$TRAVIS_EVENT_TYPE" == "cron" ]]; then
# This will not happen if the publish step hasn't happened yet
run "npx lerna publish --conventional-graduate --yes"
fi
fi