From bcd263bddac38e209ddb8d141a8de2ed52b51101 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Mon, 14 Aug 2023 22:10:37 +0300 Subject: [PATCH] setup automatic publish (#197) --- .github/workflows/publish.yml | 44 +++++++++++++++++++++++++++++++++++ package.json | 1 + src/editor/icons.tsx | 2 +- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..e5b6eab2 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,44 @@ +name: Publish to NPM +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' +permissions: {} +jobs: + ci: + permissions: + contents: read # for actions/checkout + security-events: write # for codeql-action + uses: ./.github/workflows/ci.yml + + npm-publish: + environment: + name: npm-publish + url: https://www.npmjs.com/package/graphql-faker/v/${{github.ref_name}} + needs: ci + permissions: + contents: read # for actions/checkout + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + cache: npm + node-version-file: '.node-version' + # 'registry-url' is required for 'npm publish' + registry-url: 'https://registry.npmjs.org' + + - uses: actions/download-artifact@v3 + with: + name: npmDist + path: npmDist + + - name: Publish package on NPM + run: npm publish ./npmDist + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 83ce8c89..1966da64 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "node": ">= 18.12.0" }, "scripts": { + "preversion": "npm ci --ignore-scripts && npm test", "test": "npm run lint && npm run check && npm run prettier:check && npm run check:spelling", "lint": "eslint --cache --max-warnings 0 .", "check": "tsc --noEmit", diff --git a/src/editor/icons.tsx b/src/editor/icons.tsx index 4b50ebad..62ee7615 100644 --- a/src/editor/icons.tsx +++ b/src/editor/icons.tsx @@ -1,4 +1,4 @@ -import * as React from 'react' +import * as React from 'react'; export const EditIcon = () => (