Skip to content

Commit

Permalink
Add a release job to publish on pypi on github tag creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Oct 14, 2023
1 parent 6be0547 commit 56fa1d1
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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
url: https://pypi.org/project/pylint-pytest/
steps:
- name: Check out code from Github
uses: actions/[email protected]
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON }}
check-latest: true
- name: Install requirements
run: |
# Remove dist, build, and pylint.egg-info
# when building locally for testing!
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 56fa1d1

Please sign in to comment.