File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Tag on version bump
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+
8
+ permissions :
9
+ contents : write
10
+
11
+ jobs :
12
+ tag :
13
+ name : Create tag if version changed
14
+ runs-on : ubuntu-latest
15
+
16
+ steps :
17
+ - name : Checkout code
18
+ uses : actions/checkout@v4
19
+ with :
20
+ fetch-depth : 0
21
+
22
+ - name : Get current version from pyproject.toml
23
+ id : current
24
+ run : |
25
+ VERSION=$(grep '^version =' pyproject.toml | cut -d '"' -f2)
26
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
27
+
28
+ - name : Get previous version from main~1
29
+ id : previous
30
+ run : |
31
+ git checkout HEAD~1
32
+ PREV_VERSION=$(grep '^version =' pyproject.toml | cut -d '"' -f2)
33
+ echo "version=$PREV_VERSION" >> $GITHUB_OUTPUT
34
+
35
+ - name : Compare versions and create tag if changed
36
+ if : steps.current.outputs.version != steps.previous.outputs.version
37
+ run : |
38
+ git config user.name "github-actions[bot]"
39
+
40
+ TAG="v${{ steps.current.outputs.version }}"
41
+ git tag "$TAG"
42
+ git push origin "$TAG"
You can’t perform that action at this time.
0 commit comments