Skip to content

Commit 3c8dc85

Browse files
authored
Merge pull request #6 from scrapy-plugins/feature/github-actions-publish
Add github action to publish to pypi on new tag
2 parents 6dc396e + cf0a61f commit 3c8dc85

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ name: Check test and code linting
22
on: [push]
33

44
jobs:
5-
pre-commit:
5+
lint:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v3
99
- uses: pre-commit/[email protected]
1010

11-
build:
11+
test:
1212
runs-on: ubuntu-20.04
13+
needs: lint
1314
strategy:
1415
matrix:
1516
include:
@@ -31,3 +32,26 @@ jobs:
3132
pip install tox codecov
3233
- name: Run tests
3334
run: tox -e ${{ matrix.tox || 'py' }}
35+
36+
publish:
37+
needs: test
38+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
39+
steps:
40+
- uses: actions/checkout@master
41+
- name: Set up Python 3.11
42+
uses: actions/setup-python@v3
43+
with:
44+
python-version: "3.11"
45+
46+
- name: Install dependencies
47+
run: |
48+
python -m pip install --upgrade pip
49+
pip install setuptools wheel twine
50+
51+
- name: Build and publish
52+
env:
53+
TWINE_USERNAME: __token__
54+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
55+
run: |
56+
python setup.py sdist bdist_wheel
57+
twine upload dist/*

0 commit comments

Comments
 (0)