television/.github/workflows/update_readme.yml
Alexandre Pasmantier 0f6aad952f
chore: add readme version update to github actions (#55)
* chore: add readme version update to github actions

* Update changelog

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-22 13:24:00 +01:00

34 lines
1.1 KiB
YAML

name: update_readme
permissions:
contents: write
on:
push:
tags:
- '[v]?[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
update-readme-version:
name: Update README.md with new version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update README.md
run: |
sed -i "/television/s/[0-9]\+\.[0-9]\+\.[0-9]\+/${{ github.event.ref }}/g" README.md
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Commit changes
run: |
git checkout ${{ steps.extract_branch.outputs.branch }}
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
set +e
git add README.md
git commit -m "Update README.md with new version"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git ${{ steps.extract_branch.outputs.branch }}