From 515dbbc183e935d315a428212ba1e318f6fe7251 Mon Sep 17 00:00:00 2001 From: Carlin Isaacson Date: Thu, 13 Dec 2018 13:23:24 -0800 Subject: [PATCH] fix(ci): Test CI Release --- .circleci/config.yml | 32 ++++++++++++++++++++++++++++---- package.json | 22 ++++++++++++++++++++-- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 710fa9d..67f7ae4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,8 +30,7 @@ jobs: - node_modules key: v1-dependencies-{{ checksum "package.json" }} - - tests: + rollup_and_tests: <<: *defaults steps: - checkout @@ -41,15 +40,40 @@ jobs: - v1-dependencies-{{ checksum "package.json" }} # fallback to using the latest cache if no exact match is found - v1-dependencies- + - run: + name: Run rollup + command: yarn build - run: name: Run tests command: yarn test + publish: + <<: *defaults + steps: + - checkout + - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + - restore_cache: + name: Restore node modules + keys: + - v1-dependencies-{{ checksum "package.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + # Run semantic-release after all the above is set. + - run: + name: Publish to NPM + command: yarn ci:publish # this will be added to your package.json scripts + workflows: version: 2 test_and_release: jobs: - setup - - tests: + - rollup_and_tests: + requires: + - setup + - publish: requires: - - setup \ No newline at end of file + - rollup_and_tests + filters: + branches: + only: master \ No newline at end of file diff --git a/package.json b/package.json index 175df11..af43cea 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,9 @@ "coverage": "nyc ava", "build": "rollup -c", "lint": "standard", - "prepublishOnly": "npm run build" + "prepublishOnly": "npm run build", + "ci:publish": "yarn semantic-release", + "semantic-release": "semantic-release" }, "keywords": [ "redux" @@ -30,6 +32,7 @@ "ramdasauce": "^2.0.0" }, "devDependencies": { + "@semantic-release/git": "^7.0.5", "ava": "^0.21.0", "babel-cli": "^6.24.0", "babel-eslint": "^7.2.1", @@ -38,12 +41,12 @@ "babel-preset-es2015": "^6.24.0", "babel-preset-es2015-rollup": "^3.0.0", "babel-preset-stage-0": "^6.22.0", - "np": "^2.16.0", "nyc": "^11.1.0", "rollup": "^0.47.2", "rollup-plugin-babel": "^3.0.1", "rollup-plugin-filesize": "^1.4.2", "rollup-plugin-ramda": "^1.0.5", + "semantic-release": "^15.12.5", "standard": "^10.0.1" }, "ava": { @@ -60,5 +63,20 @@ }, "standard": { "parser": "babel-eslint" + }, + "release": { + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + "@semantic-release/npm", + "@semantic-release/github", + [ + "@semantic-release/git", + { + "assets": "package.json", + "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + } + ] + ] } }