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

Add github action to be able to release on published tag #582

Merged
merged 6 commits into from Jan 2, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,47 @@
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-dev
url: https://test.pypi.org/project/pydocstyle/
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 -U pip twine wheel
python -m pip install -U "setuptools>=56.0.0"
- name: Build distributions
run: |
python setup.py sdist bdist_wheel

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direct invocation of setup.py is deprecated, current best practice is to use python -m build instead.

- 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/*