-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update .travis.yml * Update .travis.yml * Update .travis.yml * Add version check to travis * Add NPM Package version check * Fix .travis.yml indentation * Increase commander version and fix echo in travis * Increase package version * Add if conditions for the deployment stages
- Loading branch information
Marcos Vinícius Rubido
committed
May 10, 2019
1 parent
38d5f59
commit daa074f
Showing
3 changed files
with
51 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,30 +3,56 @@ language: node_js | |
node_js: | ||
- "node" | ||
- "lts/*" | ||
|
||
env: | ||
global: | ||
- REPO_VERSION="$(npx -c 'echo "$npm_package_version"')" | ||
|
||
before_install: | ||
- echo "REPO_VERSION=$REPO_VERSION" | ||
|
||
|
||
before_script: | ||
- npm run lint | ||
|
||
before_deploy: | ||
- REPO_VERSION="$(npx -c 'echo "$npm_package_version"')" | ||
- echo "REPO_VERSION=$REPO_VERSION" | ||
- npm run build | ||
- TPLANT_VERSION="$(node dist/index.js -V)" | ||
- echo "TPLANT_VERSION=$TPLANT_VERSION" | ||
- NPM_PACKAGE_VERSION="$(npx tplant -V)" | ||
- echo "NPM_PACKAGE_VERSION=$NPM_PACKAGE_VERSION" | ||
- echo "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST" | ||
- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH" | ||
- | | ||
if [ "$REPO_VERSION" != "$TPLANT_VERSION" ]; then | ||
echo -e '\033[0;31mPackage version and commander version must be the same.'; | ||
travis_terminate 1; | ||
fi | ||
- | | ||
if [ "$TRAVIS_BRANCH" == "master" ]; then | ||
git tag -a -f "$REPO_VERSION" | ||
echo "New Tag $(git describe --tags)"; | ||
if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [ "$REPO_VERSION" == "$NPM_PACKAGE_VERSION" ]; then | ||
echo -e '\033[0;31mPackage version must be higher than the current one.'; | ||
travis_terminate 1; | ||
fi | ||
- npm run lint | ||
|
||
jobs: | ||
include: | ||
- stage: "Github Deployment" | ||
if: branch = master AND type = push | ||
node_js: "lts/*" | ||
install: skip | ||
before_script: skip | ||
script: skip | ||
before_deploy: | ||
- REPO_VERSION="$(npx -c 'echo "$npm_package_version"')" | ||
- echo "REPO_VERSION=$REPO_VERSION" | ||
- git tag -f "$REPO_VERSION" | ||
- echo "New Tag $(git describe --tags)"; | ||
|
||
deploy: | ||
provider: releases | ||
api_key: $GITHUB_TOKEN | ||
|
||
deploy: | ||
- provider: releases | ||
api_key: $GITHUB_TOKEN | ||
on: | ||
branch: master | ||
- provider: npm | ||
api_key: $NPM_API_KEY | ||
on: | ||
tags: true | ||
- stage: "npm Deployment" | ||
if: tag IS present | ||
node_js: "lts/*" | ||
before_script: skip | ||
script: skip | ||
deploy: | ||
provider: npm | ||
email: "[email protected]" | ||
api_key: $NPM_API_KEY | ||
skip_cleanup: true | ||
on: | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters