Skip to content

Commit 37a5b9b

Browse files
committed
Add GitHub Actions workflow to update README with NPM version on release
1 parent 67ca900 commit 37a5b9b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Update README with NPM version
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
update-readme:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
15+
- name: Update README with NPM version
16+
run: |
17+
npm install -g npm
18+
VERSION=$(npm info react-use-observe-changes version)
19+
sed -i "s/\[!\[npm version\].*]/\[!\[npm version](https:\/\/badge.fury.io\/js\/react-use-observe-changes.svg)](https:\/\/www.npmjs.com\/package\/react-use-observe-changes)/" README.md
20+
git config user.name "github-actions[bot]"
21+
git config user.email "github-actions[bot]@users.noreply.github.com"
22+
git add README.md
23+
git commit -m "Update README with NPM version $VERSION"
24+
git push

0 commit comments

Comments
 (0)