@@ -3,11 +3,33 @@ name: Versioning & Release
3
3
on :
4
4
push :
5
5
branches :
6
- - main # Only auto-increment when committing to main
6
+ - main
7
7
8
8
jobs :
9
+ check-tests :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ - name : Get Test Results
14
+ uses : actions/download-artifact@v4
15
+ with :
16
+ name : TESTS_PASSED
17
+ path : $GITHUB_ENV
18
+
19
+ - name : Read Commit Message
20
+ id : commit_msg
21
+ run : echo "COMMIT_MSG=$(git log -1 --pretty=%B)" >> $GITHUB_ENV
22
+
23
+ - name : Skip Release if Tests Failed (Unless Forced)
24
+ if : env.TESTS_PASSED == 'failure' && !contains(env.COMMIT_MSG, 'FORCE-RELEASE')
25
+ run : |
26
+ echo "Tests failed. Skipping release."
27
+ exit 1
28
+
9
29
versioning :
30
+ needs : check-tests
10
31
runs-on : ubuntu-latest
32
+ if : success() # Only runs if check-tests job passes
11
33
12
34
steps :
13
35
- name : Checkout Repository
16
38
- name : Read Current Version
17
39
id : get_version
18
40
run : |
19
- VERSION=$(grep '^__version__ =' cli_monitor.py | cut -d '"' -f2)
41
+ VERSION=$(grep '^__version__ =' cli_monitor.py | cut -d '"' -f2)
20
42
echo "CURRENT_VERSION=$VERSION" >> $GITHUB_ENV
21
43
22
44
- name : Determine Version Increment
@@ -48,12 +70,14 @@ jobs:
48
70
run : sed -i "s/^__version__ = .*/__version__ = \"${{ env.NEW_VERSION }}\"/" cli_monitor.py
49
71
50
72
- name : Commit & Push Version Update
73
+ env :
74
+ GH_PAT : ${{ secrets.GH_PAT }}
51
75
run : |
52
76
git config --global user.name "github-actions[bot]"
53
77
git config --global user.email "github-actions@users.noreply.github.com"
54
78
git add cli_monitor.py
55
79
git commit -m "chore: bump version to ${{ env.NEW_VERSION }}"
56
- git push
80
+ git push https://Dimos082:${GH_PAT}@github.com/Dimos082/cli-monitor.git
57
81
58
82
- name : Create GitHub Release
59
83
uses : softprops/action-gh-release@v2
0 commit comments