Publish Python Package #10
Workflow file for this run
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 Python Package | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/stock-analysis-program/ | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "latest" | |
| cache: "pip" | |
| - name: Install release tooling | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install poetry twine | |
| - name: Validate package metadata | |
| run: poetry check | |
| - name: Install dependencies | |
| run: poetry install --with dev | |
| - name: Run tests | |
| run: poetry run pytest -q | |
| - name: Build distributions | |
| run: poetry build | |
| - name: Check distributions | |
| run: twine check dist/* | |
| - name: Publish to PyPI | |
| env: | |
| POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} | |
| run: poetry publish |