Skip to content

Commit

Permalink
ci: publish npm package using github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
samshara committed Apr 26, 2023
1 parent 2174954 commit 592ab94
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 15 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/prepare_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Prepare Release

permissions:
contents: write

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 16.x

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 16 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
name: Release

permissions:
contents: write

on:
push:
tags:
- 'v*'
release:
types: [publised]

jobs:
release:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
fetch-depth: 0
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.x

- run: npx changelogithub
node-version: 16
registry-url: https://registry.npmjs.org/
- run: yarn build
- run: yarn publish --access public
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ifrc-go-icons",
"name": "@ifrc-go/icons",
"version": "1.0.0",
"description": "IFRC-GO icons library for React.",
"keywords": [
Expand Down Expand Up @@ -27,7 +27,7 @@
"types": "./dist/*.d.ts"
},
"scripts": {
"prepack": "npm run build",
"prepack": "yarn build",
"build": "rimraf ./dist && node ./scripts/build.js"
},
"peerDependencies": {
Expand Down

0 comments on commit 592ab94

Please sign in to comment.