Skip to content

Commit

Permalink
Create 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 b2bf6a3 commit 78aebb9
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/create_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update Version and README

on:
push:
branches:
- main

jobs:
update_version_and_readme:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Determine current date
id: current_date
run: echo "::set-output name=date::$(date +'%Y%m%d')"

- name: Read merge counter from file
id: read_counter
run: echo "::set-output name=counter::$(cat counter.txt || echo '0')"

- name: Increment merge counter
id: increment_counter
run: echo "::set-output name=counter::${{ steps.read_counter.outputs.counter + 1 }}"

- name: Update version file with date and merge counter
run: echo "3.0.0.${{ steps.current_date.outputs.date }}.${{ steps.increment_counter.outputs.counter }}" > VERSION.txt

- name: Update README.md
run: sed -i "s/Current Version: .*/Current Version: 3.0.0.${{ steps.current_date.outputs.date }}.${{ steps.increment_counter.outputs.counter }}/" README.md

- name: Commit version and README update
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add VERSION.txt README.md
git commit -m "Update version to 3.0.0.${{ steps.current_date.outputs.date }}.${{ steps.increment_counter.outputs.counter }}"
git push

0 comments on commit 78aebb9

Please sign in to comment.