Skip to content

Commit

Permalink
Correctly set npm tag when deploying
Browse files Browse the repository at this point in the history
  • Loading branch information
astorije committed May 20, 2018
1 parent 189d1cb commit 2e3390d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,29 @@ notifications:
on_success: never
on_failure: always

# Identifies `a.b.c-xxx.n` tags as pre-releases, and `a.b.c` as stable releases
before_deploy: |
function npm_dist_tag() {
if [[ "$TRAVIS_TAG" = *"-"* ]]; then
echo "next"
else
echo "latest"
fi
}
deploy:
provider: npm
tag: $(npm_dist_tag)
email: [email protected]
api_key:
secure: Gjd/+7HvWJhVopSDHGirlMjk872jDK+/pW/s1cE5pHFz5Zfbn4wpAuoncQ8oLNwnndPkAMwBzNvwpOfQiCrccIuERY6f73Jtmd+dzGCgf7WRFB1Jz0ih06Xu/CSNN/nApaMMoj++/s/m6lu+NLNOgQ7aYZEEwJyfi3T7ik0AcJ4=
on:
node: 8
tags: true
repo: astorije/chai-immutable

# If the current release is a stable release, remove potential pre-release tag
after_deploy: |
if [ "$(npm_dist_tag)" == "latest" ]; then
npm dist-tag rm thelounge next || true
fi

0 comments on commit 2e3390d

Please sign in to comment.