Updated readme #104
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: Build and Publish | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Trigger on version tags | |
| branches: | |
| - main # Build on main for testing | |
| pull_request: # Build on PRs for testing | |
| jobs: | |
| build: | |
| name: Build wheel | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install build dependencies | |
| run: python -m pip install --upgrade pip build | |
| - name: Build wheel | |
| run: python -m build --wheel | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: ./dist/*.whl | |
| publish: | |
| name: Publish to PyPI | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install twine | |
| run: python -m pip install --upgrade pip twine | |
| - name: Publish to Test PyPI | |
| if: contains(github.ref, '-rc') || contains(github.ref, '-beta') || contains(github.ref, '-alpha') | |
| run: twine upload --skip-existing --repository testpypi dist/*.whl | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
| - name: Publish to PyPI | |
| if: ${{ !contains(github.ref, '-rc') && !contains(github.ref, '-beta') && !contains(github.ref, '-alpha') }} | |
| run: twine upload --skip-existing dist/*.whl | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_AZPYPE }} |