Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

refactor: Publish workflow

Laerte Pereira12559ed21e7b
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 02cf0c9fa..bf368cc2f 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -1,31 +1,21 @@
name: Publish
-on: [push]
+on:
+ push:
+ tags:
+ - '[0-9]+.[0-9]+.[0-9]+'
jobs:
publish:
runs-on: ubuntu-latest
- if: startsWith(github.event.ref, 'refs/tags/')
-
steps:
- - uses: actions/checkout@v3
-
- - name: Set up Python
- uses: actions/setup-python@v4
- with:
- python-version: "3.11"
-
- - name: Check Tag
- id: check-release-tag
- run: |
- if [[ ${{ github.event.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+(rc[0-9]+|[.]dev[0-9]+)?$ ]]; then
- echo "release_tag=true" >> $GITHUB_OUTPUT
- fi
-
- - name: Publish to PyPI
- if: steps.check-release-tag.outputs.release_tag == 'true'
- run: |
- pip install --upgrade build twine
- python -m build
- export TWINE_USERNAME=__token__
- export TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }}
- twine upload dist/*
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v4
+ with:
+ python-version: 3.11
+ - run: |
+ pip install --upgrade build twine
+ python -m build
+ - name: Publish to PyPI
+ uses: pypa/gh-action-pypi-publish@release/v1.6.4
+ with:
+ password: ${{ secrets.PYPI_TOKEN }}