Skip to content

Commit

Permalink
Update update-readme.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Breakout-X authored Oct 31, 2024
1 parent e721bd6 commit 9efed83
Showing 1 changed file with 35 additions and 41 deletions.
76 changes: 35 additions & 41 deletions .github/workflows/update-readme.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
name: Update README with Latest Version and Date

on:
push:
branches:
- main
tags:
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')
mkdir -p .temp
echo "**Current Version:** $VERSION" > .temp/VERSION.txt
echo "**Release Date:** $(date +'%a, %b %d, %Y' || echo "Wed, Oct 30, 2024")" > .temp/DATE.txt
- name: Update README
run: |
version=$(cat .temp/VERSION.txt)
date=$(cat .temp/DATE.txt)
grep -v '**Current Version:**' .github/README.md > temp && mv temp .github/README.md
echo "$version <br>" >> .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
- name: Cleanup temp files
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')
mkdir -p .temp
echo "**Current Version:** $VERSION" > .temp/VERSION.txt
echo "**Release Date:** $(date +'%a, %b %d, %Y' || echo "Wed, Oct 30, 2024")" > .temp/DATE.txt
- name: Update README
run: |
version=$(cat .temp/VERSION.txt)
date=$(cat .temp/DATE.txt)
grep -v '**Current Version:**' .github/README.md > temp && mv temp .github/README.md
echo "$version <br>" >> .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 diff-index --quiet HEAD || git commit -m "Update README with latest version and date"
git push
- name: Cleanup temp files
run: rm -rf .temp

0 comments on commit 9efed83

Please sign in to comment.