Skip to content

update_version_on_tag #2

update_version_on_tag

update_version_on_tag #2

Workflow file for this run

name: update_version_on_tag
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Update README.md badges
run: |
current_time=$(date +%s)
sed -i 's/\(v=\)[0-9]*/\1'"$current_time"'/g' README.md
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
git diff --quiet && git diff --staged --quiet || git commit -m "Update version to ${{ steps.get_version.outputs.VERSION }}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.event.repository.default_branch }}