Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Add github action to be able to release on published tag (#582)
Browse files Browse the repository at this point in the history
* Add github action to be able to release on published tag

* Use the pypi-prod environnement for releasing the package

* Upgrade to use an environnement

* handle the two environnement

* Remove pypi-dev that made no sense, we should create another workflow

* Take review comment into account

See #582
  • Loading branch information
Pierre-Sassoulas committed Jan 2, 2023
1 parent a6fe422 commit f1dc7be
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,43 @@
name: Release

on:
release:
types:
- published

env:
DEFAULT_PYTHON: "3.11"

permissions:
contents: read

jobs:
release-pypi:
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi-prod
url: https://pypi.org/project/pydocstyle/
steps:
- name: Check out code from Github
uses: actions/checkout@v3.2.0
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v4.4.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Install requirements
run: |
python -m pip install twine build
- name: Build distributions
run: |
python -m build
- name: Upload to PyPI
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
env:
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload --verbose dist/*

0 comments on commit f1dc7be

Please sign in to comment.