Skip to content

Commit

Permalink
Fix travis (#30)
Browse files Browse the repository at this point in the history
* 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
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 25 deletions.
72 changes: 49 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tplant",
"version": "2.1.3",
"version": "2.1.4",
"description": "Typescript to PlantUML",
"keywords": [
"Class Diagram",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { convertToPlant } from './convertToPlant';
import { generateDocumentation } from './generateDocumentation';

commander
.version('2.1.3')
.version('2.1.4')
.usage('[options]')
.option('-i, --input <path>', 'Define the path of the Typescript file')
.option('-o, --output <path>', 'Define the path of the output file. If not defined, it\'ll output on the STDOUT')
Expand Down

0 comments on commit daa074f

Please sign in to comment.