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.ref_name }}/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 "docs(version): update README.md with new version" git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git ${{ steps.extract_branch.outputs.branch }}