diff --git a/.travis.yml b/.travis.yml index bd211b9..8e73e3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,52 @@ language: node_js -node_js: - - "node" - - "lts/*" +jobs: + include: + - stage: "Run Linter and Tests" + node_js: + - "node" + - "lts/*" + before_script: + - 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_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 -env: - global: - - REPO_VERSION="$(npx -c 'echo "$npm_package_version"')" + - stage: "Github Deployment" + if: branch = master AND type = push + install: 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 -before_install: - - echo "REPO_VERSION=$REPO_VERSION" - -before_script: - - npm run lint - -before_deploy: - - | - if [ "$TRAVIS_BRANCH" == "master" ]; then - git tag -a -f "$REPO_VERSION" - echo "New Tag $(git describe --tags)"; - fi - -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 + script: skip + deploy: + provider: npm + email: "brian.folts@gmail.com" + api_key: $NPM_API_KEY + on: + tags: true \ No newline at end of file diff --git a/package.json b/package.json index c6e8714..6edba12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tplant", - "version": "2.1.3", + "version": "2.1.4", "description": "Typescript to PlantUML", "keywords": [ "Class Diagram", diff --git a/src/index.ts b/src/index.ts index 0201ff9..0784def 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 ', 'Define the path of the Typescript file') .option('-o, --output ', 'Define the path of the output file. If not defined, it\'ll output on the STDOUT')