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