40 lines (32 loc) · 996 Bytes
/
publish-on-pypi.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
name: Publish on PyPI
on:
push:
tags:
# After vMajor.Minor.Patch _anything_ is allowed (without "/") !
- v[0-9]+.[0-9]+.[0-9]+*
jobs:
publish:
runs-on: ubuntu-latest
if: github.repository == 'neelravi/aiida-champ' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Upgrade setuptools and install package
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -e .
- name: Assert package version
env:
TAG_VERSION: ${{ github.ref }}
run: python ./.github/check_version.py
- name: Build source distribution
run: python ./setup.py sdist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}