|
| 1 | +# PyPI Trusted Publisher Setup Guide |
| 2 | + |
| 3 | +## Current Error |
| 4 | +The error message shows these claims from your GitHub Action: |
| 5 | +- `sub`: `repo:PSPDFKit/nutrient-dws-client-python:ref:refs/heads/main` |
| 6 | +- `repository`: `PSPDFKit/nutrient-dws-client-python` |
| 7 | +- `repository_owner`: `PSPDFKit` |
| 8 | +- `workflow_ref`: `PSPDFKit/nutrient-dws-client-python/.github/workflows/publish-existing-tag.yml@refs/heads/main` |
| 9 | + |
| 10 | +## Configure PyPI Trusted Publisher |
| 11 | + |
| 12 | +1. Go to https://pypi.org/manage/project/nutrient-dws/settings/publishing/ |
| 13 | +2. Under "Trusted Publishers", click "Add a new publisher" |
| 14 | +3. Select "GitHub" as the publisher type |
| 15 | +4. Fill in the following: |
| 16 | + |
| 17 | +### For Workflow Dispatch (Manual Trigger) |
| 18 | +- **Repository owner**: `PSPDFKit` |
| 19 | +- **Repository name**: `nutrient-dws-client-python` |
| 20 | +- **Workflow name**: `publish-existing-tag.yml` |
| 21 | +- **Environment name**: (leave empty) |
| 22 | + |
| 23 | +### For Release Workflow |
| 24 | +Add another trusted publisher: |
| 25 | +- **Repository owner**: `PSPDFKit` |
| 26 | +- **Repository name**: `nutrient-dws-client-python` |
| 27 | +- **Workflow name**: `release.yml` |
| 28 | +- **Environment name**: (leave empty) |
| 29 | + |
| 30 | +### For Simple Manual Workflow |
| 31 | +Add another trusted publisher: |
| 32 | +- **Repository owner**: `PSPDFKit` |
| 33 | +- **Repository name**: `nutrient-dws-client-python` |
| 34 | +- **Workflow name**: `publish-manual.yml` |
| 35 | +- **Environment name**: (leave empty) |
| 36 | + |
| 37 | +## Important Notes |
| 38 | + |
| 39 | +1. The workflow name must match EXACTLY (including the `.yml` extension) |
| 40 | +2. Do NOT include `.github/workflows/` in the workflow name |
| 41 | +3. Environment should be left empty unless you're using GitHub environments |
| 42 | +4. The repository owner must match the GitHub organization/user exactly (case-sensitive) |
| 43 | + |
| 44 | +## Alternative: Publish from v1.0.2 Tag |
| 45 | + |
| 46 | +If you want to publish directly from the tag, you could: |
| 47 | +1. Go to the v1.0.2 tag on GitHub |
| 48 | +2. Run the `publish-manual.yml` workflow from that tag |
| 49 | +3. This would make the ref claim match `refs/tags/v1.0.2` |
| 50 | + |
| 51 | +## Debugging |
| 52 | + |
| 53 | +To see what claims your workflow is sending: |
| 54 | +1. Run the workflow again |
| 55 | +2. Check the error message for the exact claims |
| 56 | +3. Ensure your PyPI configuration matches those claims exactly |
| 57 | + |
| 58 | +## Quick Test |
| 59 | + |
| 60 | +After configuring the trusted publisher: |
| 61 | +1. Try the simplest workflow first: `publish-manual.yml` |
| 62 | +2. Run it from the main branch |
| 63 | +3. If it works, then try the tag-specific workflows |
0 commit comments