-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (35 loc) · 1.27 KB
/
update-readme.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Update README with Latest Version
on:
push:
branches:
- main
tags:
- 'v*'
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract latest version
id: get_version
run: |
VERSION=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "v3.13.0")
DATE=$(date +'%a, %b %d, %Y')
echo "**Current Version:** $VERSION" > VERSION.txt
echo "**Release Date:** $(date +'%a, %b %d, %Y' || echo "Wed, Oct 30, 2024")" > DATE.txt
- name: Update README
run: |
version=$(cat VERSION.txt)
date=$(cat DATE.txt)
grep -v '**Current Version:**' .github/README.md > temp && mv temp .github/README.md
echo "$version" >> .github/README.md
grep -v '**Release Date:**' .github/README.md > temp && mv temp .github/README.md
echo "$date" >> .github/README.md
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .github/README.md
git commit -m "Update README with latest version and date"
git push