-
-
Notifications
You must be signed in to change notification settings - Fork 50
62 lines (60 loc) · 2.04 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: PyPI
on:
pull_request:
branches: [main]
push:
branches: [main]
release:
types: [published]
jobs:
build:
name: build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Build the sdist and the wheel
run: |
pip install build
python3 -m build
- name: Check the sdist installs and imports
run: |
mkdir -p test-sdist
cd test-sdist
python -m venv venv-sdist
venv-sdist/bin/python -m pip install numpy
venv-sdist/bin/python -m pip install ../dist/pymc_extras*.tar.gz
echo "Checking import and version number (on release)"
venv-sdist/bin/python -c "import pymc as pmx; assert pmx.__version__ == '${{ github.ref_name }}'[1:] if '${{ github.ref_type }}' == 'tag' else True; print(pmx.__version__)"
cd ..
- name: Check the bdist installs and imports
run: |
mkdir -p test-bdist
cd test-bdist
python -m venv venv-bdist
venv-bdist/bin/python -m pip install ../dist/pymc*.whl
echo "Checking import and version number (on release)"
venv-bdist/bin/python -c "import pymc as pmx; assert pmx.__version__ == '${{ github.ref_name }}'[1:] if '${{ github.ref_type }}' == 'tag' else pmx.__version__; print(pmx.__version__)"
cd ..
- uses: actions/upload-artifact@v3
with:
name: artifact
path: dist/*
publish:
name: upload release to PyPI
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}