Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
samestrin committed Apr 26, 2024
1 parent cd5fd42 commit 88dda6c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Update README Version Badge

on:
push:
branches:
- main # Ensure this is your default branch
paths:
- "package.json"
workflow_dispatch:

jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update README
run: |
VERSION=$(sed -n 's/^.*"version": "\(.*\)".*$/\1/p' composer.json)
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
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "Update version badge"
git push
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}

0 comments on commit 88dda6c

Please sign in to comment.