-
Notifications
You must be signed in to change notification settings - Fork 92
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
6d672bc
commit f034e4a
Showing
1 changed file
with
22 additions
and
11 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 |
---|---|---|
|
@@ -2,8 +2,8 @@ name: Update Version and README | |
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
branches: | ||
- 'Issue#*' | ||
|
||
jobs: | ||
update_version_and_readme: | ||
|
@@ -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: | ||
|
@@ -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')" | ||
|
@@ -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 }}" |