Skip to content

Commit 9aeb49a

Browse files
committed
Setup github action for npm publishing
1 parent 1cab4a7 commit 9aeb49a

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish to NPM
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: 16
15+
cache: 'yarn'
16+
- run: yarn install --immutable
17+
- run: yarn build
18+
name: Build
19+
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc
20+
- run: |
21+
VERSION=${{ github.event.release.tag_name }}
22+
echo "VERSION=${VERSION:1}" >> $GITHUB_ENV
23+
- name: Publish
24+
run: yarn publish --access public --new-version ${{ env.VERSION }}
25+
- uses: stefanzweifel/git-auto-commit-action@v4
26+
with:
27+
commit_message: Publish version ${{ env.VERSION }}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
"@vitejs/plugin-react": "^2.0.0",
2323
"eslint": "^8.20.0",
2424
"eslint-plugin-react": "^7.30.1",
25-
"vite": "^3.0.4",
2625
"react": "^18.2.0",
27-
"react-dom": "^18.2.0"
26+
"react-dom": "^18.2.0",
27+
"vite": "^3.0.4"
2828
},
2929
"peerDependencies": {
3030
"react": "^18.2.0",

0 commit comments

Comments
 (0)