Rename Repo #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update README Version Badge | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "package.json" | |
jobs: | |
update-packages: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- name: Update README Version Badge | |
run: | | |
VERSION=$(node -p "require('./package.json').version") | |
sed -i "s/Version [0-9]*\.[0-9]*\.[0-9]*/Version $VERSION/g" README.md | |
sed -i "s/badge\/Version-[0-9]*\.[0-9]*\.[0-9]*-/badge\/Version-$VERSION-/g" README.md | |
- name: Commit changes | |
run: | | |
git config --global user.name 'GitHub Actions Bot' | |
git config --global user.email 'actions@github.com' | |
git add package.json package-lock.json README.md | |
git commit -m "Update NPM packages and README version badge" || echo "No changes to commit" | |
git push origin HEAD:${{ github.ref }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |