From 8d85c7262971711585dc9f9123af91a7fb9eb036 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Thu, 23 Apr 2020 13:00:35 +0200 Subject: [PATCH] build: automate release --- .bumpedrc | 31 ------------------------------- .gitignore | 1 + .travis.yml | 30 +++++++++++++++++++++++++++--- package.json | 40 +++++++++++++++++++++++++++++++++++++--- 4 files changed, 65 insertions(+), 37 deletions(-) delete mode 100644 .bumpedrc mode change 100755 => 100644 .travis.yml diff --git a/.bumpedrc b/.bumpedrc deleted file mode 100644 index 8e102a6..0000000 --- a/.bumpedrc +++ /dev/null @@ -1,31 +0,0 @@ -files: [ - 'package.json' -] - -plugins: - - prerelease: - - 'Linting config files': - plugin: 'bumped-finepack' - - postrelease: - - 'Generating CHANGELOG file': - plugin: 'bumped-changelog' - - 'Commiting new version': - plugin: 'bumped-terminal' - command: 'git add CHANGELOG.md package.json && git commit -m "Release $newVersion"' - - 'Detecting problems before publish': - plugin: 'bumped-terminal' - command: 'git-dirty && npm test' - - 'Publishing tag at GitHub': - plugin: 'bumped-terminal' - command: 'git tag $newVersion && git push && git push --tags' - - 'Publishing at NPM': - plugin: 'bumped-terminal' - command: 'npm publish' diff --git a/.gitignore b/.gitignore index ff9c36b..3dd3262 100755 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ coverage # Other ############################ .node_history +.envrc diff --git a/.travis.yml b/.travis.yml old mode 100755 new mode 100644 index 0ca8af8..c84b0d0 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,29 @@ language: node_js + node_js: - - "lts/*" - - "node" -after_success: npm run coveralls + - lts/* + - node + +after_success: npm run coverage + +stages: + - Test + - name: Release + if: branch = master AND commit_message !~ /(release|no-release)/ + +jobs: + include: + - stage: Release + node_js: lts/* + install: npm install --no-package-lock + before_deploy: + - git config user.email ${GITHUB_EMAIL:-"travis@travis-ci.org"} + - git config user.name ${GITHUB_USER:-"Travis CI"} + - git remote set-url origin https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git + - git checkout master + deploy: + skip_cleanup: true + provider: script + script: npm run release + on: + branch: master \ No newline at end of file diff --git a/package.json b/package.json index 64a9e92..5c1c89b 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,17 @@ "nyc": "latest", "should": "latest", "standard": "latest", - "standard-markdown": "latest" + "standard-markdown": "latest", + "@commitlint/cli": "latest", + "@commitlint/config-conventional": "latest", + "ci-publish": "latest", + "conventional-github-releaser": "latest", + "finepack": "latest", + "git-authors-cli": "latest", + "husky": "latest", + "lint-staged": "latest", + "npm-check-updates": "latest", + "standard-version": "latest" }, "engines": { "node": ">= 6" @@ -58,10 +68,18 @@ ], "scripts": { "clean": "rm -rf node_modules", - "coveralls": "nyc report --reporter=text-lcov | coveralls", + "coverage": "nyc report --reporter=text-lcov | coveralls", "lint": "standard-markdown && standard", "pretest": "npm run lint", - "test": "nyc mocha" + "test": "nyc mocha", + "contributors": "(git-authors-cli && finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true", + "postrelease": "npm run release:tags && npm run release:github && ci-publish", + "prerelease": "npm run update:check && npm run contributors", + "release:github": "conventional-github-releaser -p angular", + "release:tags": "git push --follow-tags origin HEAD:master", + "release": "standard-version -a", + "update:check": "ncu -- --error-level 2", + "update": "ncu -u" }, "license": "MIT", "standard": { @@ -69,5 +87,21 @@ "describe", "it" ] + }, + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + }, + "husky": { + "hooks": { + "commit-msg": "commitlint -E HUSKY_GIT_PARAMS", + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "package.json": [ + "finepack" + ] } }