-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e721bd6
commit 9efed83
Showing
1 changed file
with
35 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |