Skip to content

Commit 887ee8a

Browse files
authored
Merge pull request #38 from dhellmann/publish-action
add github action for publishing packages
2 parents 34403c8 + 4250f11 commit 887ee8a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/python-publish.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflows will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
name: Upload Python Package
5+
6+
on:
7+
- push
8+
9+
jobs:
10+
build-n-publish:
11+
name: Build and publish Python distributions to PyPI and TestPyPI
12+
if: ${{ github.repository_owner == 'python-virtualenvwrapper' }}
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.x'
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install setuptools wheel twine pbr
28+
- name: Build sdist and wheel
29+
run: |
30+
python setup.py sdist bdist_wheel
31+
- name: Publish distribution to Test PyPI
32+
uses: pypa/gh-action-pypi-publish@master
33+
with:
34+
password: ${{ secrets.test_pypi_password }}
35+
repository_url: https://test.pypi.org/legacy/
36+
- name: Publish distribution to PyPI
37+
if: startsWith(github.ref, 'refs/tags')
38+
uses: pypa/gh-action-pypi-publish@master
39+
with:
40+
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)