Skip to content

Commit 2e98a67

Browse files
authored
use github action to deploy to test.pypi.org and pypi.org (#1038)
* add pytest config to setup.cfg to silence xunit2 warning * add publish-to-test-pypi.yml * make token user explicit * better filename * whats new * remove possibility to deploy on travis * add wheel * tweaks for tags * try fetching complete history * try installing without dependencies * unshallow tags * fix syntax * print tags and dev install * pushed tags to wholmgren, retesting * clean up * add if
1 parent 71d41d2 commit 2e98a67

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish distributions to PyPI (releases only) and TestPyPI (all commits)
2+
3+
on: push
4+
5+
jobs:
6+
build-n-publish:
7+
name: Build and publish distributions to PyPI (releases only) and TestPyPI (all commits)
8+
if: github.repository == 'pvlib/pvlib-python'
9+
runs-on: ubuntu-latest
10+
steps:
11+
# fetch all commits and tags so versioneer works
12+
- uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: 3.8
20+
21+
- name: Install build tools
22+
run: |
23+
python -m pip install --upgrade pip
24+
python -m pip install --upgrade setuptools wheel
25+
26+
- name: Build packages
27+
run: python setup.py sdist bdist_wheel
28+
29+
- name: Publish distribution to Test PyPI
30+
uses: pypa/gh-action-pypi-publish@master
31+
with:
32+
user: __token__
33+
password: ${{ secrets.test_pypi_password }}
34+
repository_url: https://test.pypi.org/legacy/
35+
36+
- name: Publish distribution to PyPI
37+
if: startsWith(github.ref, 'refs/tags')
38+
uses: pypa/gh-action-pypi-publish@master
39+
with:
40+
user: __token__
41+
password: ${{ secrets.pypi_password }}

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ matrix:
1919
env:
2020
- CONDA_ENV=py36
2121
- TASK="coverage"
22-
- DEPLOY_ENV="true"
22+
# not needed as of GH1038. deploy block cannot run without this.
23+
# - DEPLOY_ENV="true"
2324
- python: 3.6
2425
env: CONDA_ENV=py37
2526

docs/sphinx/source/whatsnew/v0.8.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ Testing
112112
* Add wrappers around the pandas assert_X_equal functions to accommodate the
113113
changed API and default precision thresholds in pandas 1.1.0
114114
(:issue:`1018`, :pull:`1021`)
115+
* Add github action for publishing all commits to
116+
`test.pypi.org <https://test.pypi.org/project/pvlib/>`_ and tags to
117+
`pypi.org <https://pypi.org/project/pvlib/>`_.
115118

116119
Documentation
117120
~~~~~~~~~~~~~

setup.cfg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ test=pytest
1717
[flake8]
1818
max-line-length = 79
1919
ignore = E201, E241, E226, W503, W504
20-
exclude = pvlib/_version.py docs dist
20+
exclude = pvlib/_version.py docs dist
21+
22+
[tool:pytest]
23+
junit_family=xunit2

0 commit comments

Comments
 (0)