-
Notifications
You must be signed in to change notification settings - Fork 2
37 lines (31 loc) · 1.06 KB
/
release.yaml
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
name: Publish to PyPI
on:
release:
types: [published]
jobs:
# Publish the package to PyPI https://pypi.org
pypi-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Check version correctness
run: |
python3 .github/check_version.py --tag $GITHUB_REF_NAME --new_version $(< VERSION) --old_version $(git cat-file -p $(git rev-parse "$GITHUB_SHA"^1):VERSION)
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install .[dev]
- name: Build and publish to PyPI
if: ${{ success() }} # publish only when version passed the checks
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python3 -m build -w
twine check dist/*
twine upload --repository pypi dist/*