Commit b71e57b 1 parent 18dd46e commit b71e57b Copy full SHA for b71e57b
File tree 2 files changed +35
-0
lines changed
2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Auto Increment Version
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main # Adjust this as necessary for your repository's branch name
7
+
8
+ jobs :
9
+ create-tag :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - name : Checkout code
13
+ uses : actions/checkout@v2
14
+ with :
15
+ fetch-depth : 0 # Important to fetch all history for version calculations
16
+
17
+ - name : Read the current version
18
+ id : version_reader
19
+ run : echo "::set-output name=version::$(cat .version)"
20
+
21
+ - name : Increment version
22
+ id : version_increment
23
+ run : |
24
+ echo $(( ${{ steps.version_reader.outputs.version }} + 1 )) > .version
25
+ echo "::set-output name=new_version::$(cat .version)"
26
+
27
+ - name : Commit and Tag New Version
28
+ run : |
29
+ git config --global user.name 'GitHub Action'
30
+ git config --global user.email '[email protected] '
31
+ git add .version
32
+ git commit -m "Increment version to ${{ steps.version_increment.outputs.new_version }}"
33
+ git tag ${{ steps.version_increment.outputs.new_version }}
34
+ git push --follow-tags
Original file line number Diff line number Diff line change
1
+ 2
You can’t perform that action at this time.
0 commit comments