1
+ name : CI
2
+
3
+ on :
4
+ push :
5
+ branches : [master]
6
+ tags : ['v*']
7
+ pull_request :
8
+ branches : [master]
9
+
10
+ jobs :
11
+ test :
12
+ runs-on : ubuntu-latest
13
+ environment : ci
14
+ strategy :
15
+ matrix :
16
+ python-version : ['3.8', '3.9', '3.10', '3.11']
17
+
18
+ steps :
19
+ - uses : actions/checkout@v3
20
+ with :
21
+ fetch-depth : 0
22
+
23
+ - name : Set up Python ${{ matrix.python-version }}
24
+ uses : actions/setup-python@v4
25
+ with :
26
+ python-version : ${{ matrix.python-version }}
27
+ cache : ' pip'
28
+
29
+ - name : Install pandoc
30
+ run : |
31
+ sudo apt-get update
32
+ sudo apt-get install pandoc
33
+ pip install pypandoc
34
+
35
+ - name : Install npm
36
+ run : |
37
+ sudo npm install -g npm@latest || sudo npm install -g npm@9
38
+
39
+ - name : Install dependencies
40
+ run : pip install 'tox<4' tox-gh-actions
41
+
42
+ - name : Run tests
43
+ env :
44
+ PYTHON_VERSION : ${{ matrix.python-version }}
45
+ run : tox
46
+
47
+ - name : Install release dependencies
48
+ if : github.ref == 'refs/heads/master' && matrix.python-version == '3.8'
49
+ run : |
50
+ pip install bump-my-version
51
+ sudo npm install -g --save-dev \
52
+ @semantic-release/changelog \
53
+ @semantic-release/exec \
54
+ @semantic-release/git \
55
+ @semantic-release/github
56
+
57
+ - name : Semantic Release
58
+ if : github.ref == 'refs/heads/master' && matrix.python-version == '3.8'
59
+ run : npx semantic-release
60
+
61
+ - name : Publish to PyPI
62
+ if : startsWith(github.ref, 'refs/tags/') && matrix.python-version == '3.8'
63
+ run : |
64
+ pip install build twine
65
+ python -m build
66
+ python -m twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }}
0 commit comments