Skip to content

Commit

Permalink
Merge pull request #6 from scrapy-plugins/feature/github-actions-publish
Browse files Browse the repository at this point in the history
Add github action to publish to pypi on new tag
  • Loading branch information
VMRuiz authored Apr 4, 2024
2 parents 6dc396e + cf0a61f commit 3c8dc85
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ name: Check test and code linting
on: [push]

jobs:
pre-commit:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pre-commit/action@v3.0.0

build:
test:
runs-on: ubuntu-20.04
needs: lint
strategy:
matrix:
include:
Expand All @@ -31,3 +32,26 @@ jobs:
pip install tox codecov
- name: Run tests
run: tox -e ${{ matrix.tox || 'py' }}

publish:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@master
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*

0 comments on commit 3c8dc85

Please sign in to comment.