Skip to content

Commit

Permalink
auto-tag github action
Browse files Browse the repository at this point in the history
  • Loading branch information
learyjk committed Jun 25, 2024
1 parent 1737bd4 commit 6db74b8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/auto-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Auto Increment Version

on:
push:
branches:
- main # Adjust this as necessary for your repository's branch name

jobs:
create-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Important to fetch all history for version calculations

- name: Read the current version
id: version_reader
run: echo "::set-output name=version::$(cat .version)"

- name: Increment version
id: version_increment
run: |
echo $(( ${{ steps.version_reader.outputs.version }} + 1 )) > .version
echo "::set-output name=new_version::$(cat .version)"
- name: Commit and Tag New Version
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add .version
git commit -m "Increment version to ${{ steps.version_increment.outputs.new_version }}"
git tag ${{ steps.version_increment.outputs.new_version }}
git push --follow-tags
1 change: 1 addition & 0 deletions .version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2

0 comments on commit 6db74b8

Please sign in to comment.