1
- name : Build and Test
1
+ name : Test and Tag
2
2
3
3
on :
4
4
push :
5
- branches : [ main, develop ]
5
+ branches : [ main, development ]
6
6
pull_request :
7
- branches : [ main, develop ]
7
+ branches : [ main, development ]
8
8
release :
9
9
types : [created]
10
10
26
26
- name : Install dependencies
27
27
run : |
28
28
python -m pip install --upgrade pip
29
- pip install build pytest pytest-cov ruff
29
+ pip install build pytest pytest-cov ruff toml
30
30
pip install -r requirements.txt
31
31
pip install -e .
32
32
@@ -41,11 +41,32 @@ jobs:
41
41
- name : Build package
42
42
run : python -m build
43
43
44
+ create-tag :
45
+ needs : test
46
+ runs-on : ubuntu-latest
47
+ if : github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/development')
48
+
49
+ steps :
50
+ - uses : actions/checkout@v3
51
+
52
+ - name : Get version from pyproject.toml
53
+ id : get_version
54
+ run : |
55
+ version=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
56
+ echo "version=$version" >> $GITHUB_OUTPUT
57
+
58
+ - name : Create and push tag
59
+ run : |
60
+ git config --local user.email "[email protected] "
61
+ git config --local user.name "GitHub Action"
62
+ git tag -a "v${{ steps.get_version.outputs.version }}" -m "Release v${{ steps.get_version.outputs.version }}"
63
+ git push origin "v${{ steps.get_version.outputs.version }}"
64
+
44
65
publish :
45
66
needs : test
46
67
runs-on : ubuntu-latest
47
68
if : github.event_name == 'release' && github.event.action == 'created'
48
-
69
+
49
70
steps :
50
71
- uses : actions/checkout@v3
51
72
57
78
- name : Install dependencies
58
79
run : |
59
80
python -m pip install --upgrade pip
60
- pip install build twine
81
+ pip install build pytest pytest-cov ruff twine
82
+ pip install -r requirements.txt
83
+ pip install -e .
61
84
85
+ - name : Run tests
86
+ run : |
87
+ pytest --cov
88
+
62
89
- name : Build package
63
90
run : python -m build
64
91
0 commit comments