Skip to content

Commit

Permalink
Enable CD for publishing a new release
Browse files Browse the repository at this point in the history
  • Loading branch information
rayluo committed Dec 13, 2021
1 parent e7afbd3 commit ea91eda
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,32 @@ jobs:
TOXENV: ${{ matrix.toxenv }}
run: |
tox
cd:
needs: ci
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Build a package for release
run: |
python -m pip install build --user
python -m build --sdist --wheel --outdir dist/ .
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@v1.4.2
if: github.ref == 'refs/heads/master'
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit ea91eda

Please sign in to comment.