-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (47 loc) · 1.33 KB
/
publish.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
name: Publish Release
on:
push:
tags:
- "*"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: 'poetry'
- name: Install dependencies
run: poetry install --no-root
- name: Test Code
run: poetry run pytest
publish-pypi:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Build and upload to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
if [ $(poetry version -s) != ${{ github.ref_name }} ]; then
echo "The version specified in pyproject.toml and the tag name are not the same"
echo "Will use the tag name as version name"
poetry version ${{ github.ref_name }}
fi
poetry publish --build