Update README.md #122
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: Release (PyPI & TestPyPI) | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build dists | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Upgrade build backend | |
| run: python -m pip install --upgrade pip build | |
| - name: Build sdist & wheel | |
| run: python -m build --sdist --wheel --outdir dist/ | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-artifacts | |
| path: dist/* | |
| publish-testpypi: | |
| name: Publish to TestPyPI (on main) | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # Required for Trusted Publishing (OIDC) | |
| contents: read | |
| environment: | |
| name: testpypi | |
| url: https://test.pypi.org/p/causationentropy | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-artifacts | |
| path: dist/ | |
| - name: Publish to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| # attestations are ON by default; disable with: attestations: false | |
| verbose: true | |
| skip-existing: true | |
| # Optional: show SHA256 hashes in logs | |
| print-hash: true | |
| publish-pypi: | |
| name: Publish to PyPI (on tag) | |
| if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # Required for Trusted Publishing (OIDC) | |
| contents: read | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/causationentropy | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist-artifacts | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # attestations are ON by default; disable with: | |
| # with: | |
| # attestations: false |