From 1d14361b88e86ea44ad2d38409dd53c96f550fd3 Mon Sep 17 00:00:00 2001 From: Norbert Nader Date: Fri, 25 Feb 2022 11:48:12 -0800 Subject: [PATCH] feat: add npm-publish github workflow (#68) Co-authored-by: Norbert Nader --- .github/workflows/npm-publish.yml | 26 +++++++++++++++++++ package.json | 7 ++++- .../components/cypress/support/commands.js | 1 + packages/components/package.json | 1 + packages/core/package.json | 4 +-- packages/react-components/package.json | 1 + packages/related-table/package.json | 4 +-- packages/source-iotsitewise/package.json | 4 +-- 8 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/npm-publish.yml diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 000000000..07ebb50c6 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,26 @@ +name: NPM Publish +on: + push: + branches: + - main +jobs: + publish-to-npm: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 'lts/*' + registry-url: 'https://registry.npmjs.org' + + - name: Install and Build + run: | + yarn install + yarn build + - name: Publish + run: yarn run publishToNpm + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index ede4c937b..3b572ea89 100755 --- a/package.json +++ b/package.json @@ -21,7 +21,12 @@ "test:eslint": "eslint --ext .js,.ts,.tsx . --max-warnings 0", "test:unit": "lerna run test --stream --concurrency 1", "test:git": "git diff --exit-code", - "pack": "lerna run pack" + "pack": "lerna run pack", + "versionup:auto": "lerna version --conventional-commits --no-push --no-git-tag-version --yes", + "versionup:patch": "lerna version patch --conventional-commits --no-push --no-git-tag-version --yes", + "versionup:minor": "lerna version minor --conventional-commits --no-push --no-git-tag-version --yes", + "versionup:major": "lerna version major --conventional-commits --no-push --no-git-tag-version --yes", + "publishToNpm": "lerna publish from-package --no-verify-access --yes" }, "devDependencies": { "@babel/core": "^7.6.4", diff --git a/packages/components/cypress/support/commands.js b/packages/components/cypress/support/commands.js index 80dd50a19..6e86a8aa7 100644 --- a/packages/components/cypress/support/commands.js +++ b/packages/components/cypress/support/commands.js @@ -7,4 +7,5 @@ addChartCommands(); addMatchImageSnapshotCommand({ failureThreshold: 0.025, failureThresholdType: 'percent', + customDiffConfig: { threshold: 0.2 }, }); diff --git a/packages/components/package.json b/packages/components/package.json index 5efefe1f1..727d122f4 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,4 +1,5 @@ { + "private": true, "name": "@iot-app-kit/components", "version": "0.0.1", "description": "IoT App Kit Components", diff --git a/packages/core/package.json b/packages/core/package.json index ec61ea120..c2c6256ea 100755 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,4 +1,5 @@ { + "private": true, "name": "@iot-app-kit/core", "license": "Apache-2.0", "version": "0.0.1", @@ -6,9 +7,6 @@ "main": "./dist/index.cj.js", "module": "./dist/index.js", "types": "./dist/index.d.ts", - "publishConfig": { - "access": "public" - }, "files": [ "dist/" ], diff --git a/packages/react-components/package.json b/packages/react-components/package.json index e6d1c5967..db274626a 100644 --- a/packages/react-components/package.json +++ b/packages/react-components/package.json @@ -1,4 +1,5 @@ { + "private": true, "name": "@iot-app-kit/react-components", "license": "Apache-2.0", "sideEffects": false, diff --git a/packages/related-table/package.json b/packages/related-table/package.json index 6f65b009f..3161a79a1 100644 --- a/packages/related-table/package.json +++ b/packages/related-table/package.json @@ -1,4 +1,5 @@ { + "private": true, "name": "@iot-app-kit/related-table", "version": "1.0.0", "description": "IoT Application Kit - Related Table component", @@ -7,9 +8,6 @@ "types": "dist/index.d.ts", "module": "dist/index.module.js", "source": "src/index.ts", - "publishConfig": { - "access": "public" - }, "files": [ "dist", "src" diff --git a/packages/source-iotsitewise/package.json b/packages/source-iotsitewise/package.json index 78de4b8f2..ba1395f73 100644 --- a/packages/source-iotsitewise/package.json +++ b/packages/source-iotsitewise/package.json @@ -1,4 +1,5 @@ { + "private": true, "name": "@iot-app-kit/source-iotsitewise", "version": "0.0.1", "description": "AWS IoT SiteWise source for IoT Application Kit", @@ -14,9 +15,6 @@ "files": [ "dist/" ], - "publishConfig": { - "access": "public" - }, "repository": { "type": "git", "url": "git+https://github.com/awslabs/iot-app-kit.git"