Skip to content

Update README.md on tag creation #24

Update README.md on tag creation

Update README.md on tag creation #24

Workflow file for this run

name: Update README.md on tag creation
on:
create:
jobs:
build:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Delete tag from remote and local
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "Tag ${{ github.ref }} was created. Deleting tag '$VERSION' from remote and local. "
git tag -d $VERSION
git push --delete origin $VERSION
- name: Update README.md
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "Tagging updated README.md with '$VERSION'."
sed "s/readme-\(.*\)-blue/readme-$VERSION-blue/g" README.md > temp.md
mv temp.md README.md
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add README.md
git commit -m "Update README.md for tag '$VERSION' [skip ci]" || echo "No changes to commit"
- name: Tag latest commit
run: |
VERSION=${GITHUB_REF#refs/tags/}
git tag -fa $VERSION -m "Update tag '$VERSION' to latest commit"
git push origin $VERSION --force
echo "Pushed tag '$VERSION' to the latest commit."