-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (42 loc) · 1.24 KB
/
npm-publish-react.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Publish React NPM Package
on:
push:
paths:
- "react/**"
branches:
- main
jobs:
publish:
name: Publish React NPM Package
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
always-auth: true
node-version: "20.x"
registry-url: https://registry.npmjs.org
- name: Install Dependencies
working-directory: react
run: npm install
- name: Increment Version
working-directory: react
run: echo "NPM_PACKAGE_VERSION=$(npm version patch)" >> $GITHUB_ENV
- name: Commit Version Increment
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add react/package.json react/package-lock.json
git commit -m "${{env.NPM_PACKAGE_VERSION}}" -a
- name: Build
working-directory: react
run: npm run build
- name: Publish to NPM
working-directory: react
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
- name: Push Changes
run: git push