fix: make check step run after publish step #4
This file contains hidden or 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
| name: Publish Package to PyPI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools wheel twine build | |
| - name: Build package | |
| run: python -m build | |
| - name: Publish package | |
| id: publish | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| - name: Check deployed package | |
| run: | | |
| # Wait a moment for PyPI to process the upload | |
| sleep 30 | |
| PACKAGE_NAME=$(grep -oP "name\s*=\s*['\"](\K[^'\"]+)" setup.py || echo "logdash") | |
| VERSION=$(grep -oP "__version__\s*=\s*['\"](\K[^'\"]+)" logdash/__init__.py) | |
| echo "Checking if $PACKAGE_NAME==$VERSION is available on PyPI..." | |
| pip install $PACKAGE_NAME==$VERSION |