From a9c9d6c055c2cb406215667912350f906abca1ba Mon Sep 17 00:00:00 2001 From: Sameer Rai Date: Wed, 26 Apr 2023 16:55:15 +0545 Subject: [PATCH] ci: publish npm package using github actions --- .github/dependabot.yml | 2 +- .github/workflows/publish.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/release.yml | 2 +- README.md | 2 +- package.json | 4 ++-- 5 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index dfe34a0..85d96af 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,7 @@ version: 2 updates: - - package-ecosystem: "yarn" + - package-ecosystem: "npm" directory: "/" schedule: interval: "weekly" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..cec2fd7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish + +on: + release: + types: [publised] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - run: yarn build + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + - run: yarn build + - run: yarn publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 82047a8..015ac97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,4 +22,4 @@ jobs: - run: npx changelogithub env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 1c817cc..1e9ac57 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ npm install ifrc-go-icons Each icon can be imported as a react component. ```js -import { MenuLineIcon } from 'ifrc-go-icons'; +import { MenuLineIcon } from '@ifrc-go/icons'; function MyComponent() { return ( diff --git a/package.json b/package.json index 8b88a8e..1d02123 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "ifrc-go-icons", + "name": "@ifrc-go/icons", "version": "1.0.0", "description": "IFRC-GO icons library for React.", "keywords": [ @@ -27,7 +27,7 @@ "types": "./dist/*.d.ts" }, "scripts": { - "prepack": "npm run build", + "prepack": "yarn build", "build": "rimraf ./dist && node ./scripts/build.js" }, "peerDependencies": {