Skip to content

Commit

Permalink
Update create_version.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
DARKDRAGON-LK authored Apr 9, 2024
1 parent 6d672bc commit f034e4a
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions .github/workflows/create_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Update Version and README

on:
push:
branches:
- master
branches:
- 'Issue#*'

jobs:
update_version_and_readme:
Expand All @@ -12,7 +12,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2

with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python
uses: actions/setup-python@v2
with:
Expand All @@ -22,6 +24,16 @@ jobs:
id: current_date
run: echo "::set-output name=date::$(date +'%Y%m%d')"

- name: Reset counter if it's a new day
id: reset_counter
run: |
current_date=$(date +'%Y%m%d')
last_date=$(cat .github/last_date.txt || echo '0')
if [ "$current_date" != "$last_date" ]; then
echo "0" > .github/counter.txt
echo "$current_date" > .github/last_date.txt
fi
- name: Read merge counter from file
id: read_counter
run: echo "::set-output name=counter::$(cat .github/counter.txt || echo '0')"
Expand All @@ -40,16 +52,15 @@ jobs:
run: |
sed -i "s/Current Version:.*/Current Version: 3.0.0.${{ steps.current_date.outputs.date }}.${{ steps.increment_counter.outputs.counter }} (This line will be automatically updated to reflect the latest version)/" README.md
- name: Set up Git identity
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
- name: Stage changes
run: |
git add VERSION.txt README.md .github/counter.txt
git add VERSION.txt README.md .github/counter.txt .github/last_date.txt
- name: Commit version and README update
run: |
git commit -m "Update version to 3.0.0.${{ steps.current_date.outputs.date }}.${{ steps.increment_counter.outputs.counter }}"
git push
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: "Issue#${{ github.event.ref_name }}"

0 comments on commit f034e4a

Please sign in to comment.