Skip to content

Commit

Permalink
ci(deploy): deploy to sharvit/node-mdl-starter
Browse files Browse the repository at this point in the history
  • Loading branch information
sharvit committed Aug 2, 2019
1 parent 848f4ca commit a5d03e8
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ jobs:
provider: script
skip_cleanup: true
script: yarn semantic-release
- stage: deploy node-mdl-starter
if: tag =~ ^v AND type = push
node_js: 12
skip_install: true
script: echo "deploying node-mdl-starter with generator-node-mdl ${TRAVIS_TAG}"
deploy:
provider: script
skip_cleanup: true
script: ./script/deploy-node-mdl-starter.sh
51 changes: 51 additions & 0 deletions scripts/deploy-node-mdl-starter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

set -e

GITHUB_USERNAME="sharvit"
PROJECT_NAME="node-mdl-starter"
STARTER_GH_TOKEN=$STARTER_GH_TOKEN
STARTER_NPM_TOKEN=$STARTER_NPM_TOKEN
GENERATOR_NODE_MDL_VERSION=$TRAVIS_TAG

if [ `echo $GENERATOR_NODE_MDL_VERSION | tail -c 3` == ".0" ]
then
COMMIT_TYPE="feat"
else
COMMIT_TYPE="fix"
fi

yarn global add yo generator-node-mdl

git clone git@github.com:$GITHUB_USERNAME/$PROJECT_NAME.git
cd $PROJECT_NAME

yo node-mdl \
--npmToken $STARTER_NPM_TOKEN \
--githubToken $STARTER_GH_TOKEN \
--projectName $PROJECT_NAME \
--description "Generated by generator-node-mdl" \
--name "Avi Sharvit" \
--email "sharvita@gmail.com" \
--website "https://sharvit.github.io" \
--githubUsername $GITHUB_USERNAME \
--noDefaults \
--githubTemplates \
--coveralls \
--travisCI \
--npmDeploy \
--semanticRelease \
--force

if [ $( git diff origin/master | wc -l ) -ne 0 ]
then
git reset origin/master
git add .
git commit -m "${COMMIT_TYPE}(init): updated using generator-node-mdl ${GENERATOR_NODE_MDL_VERSION} 🔥"
git push origin master

echo "Deployed to: https://github.com/${GITHUB_USERNAME}/${PROJECT_NAME}"
else
echo "Project node-mdl-starter hasn't changed afet running generator-node-mdl ${GENERATOR_NODE_MDL_VERSION}"
echo "Nothing to deploy"
fi

0 comments on commit a5d03e8

Please sign in to comment.