forked from further-reading/scrapy-settings-log
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add github action to publish to pypi on new tag
- Loading branch information
Showing
1 changed file
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected] | ||
|
||
build: | ||
test: | ||
runs-on: ubuntu-20.04 | ||
needs: lint | ||
strategy: | ||
matrix: | ||
include: | ||
|
@@ -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/* |