Skip to content

Commit aeeb387

Browse files
committed
Enhance fallback publishing step in GitHub Actions workflow
- Added a check to ensure the PYPI_API_TOKEN secret is set before attempting fallback publishing with UV. - Improved logging to skip the fallback if the token is not available, enhancing workflow robustness.
1 parent 7793005 commit aeeb387

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,14 @@ jobs:
195195
(github.event_name == 'release' ||
196196
github.event_name == 'workflow_dispatch' ||
197197
(github.event_name == 'push' && steps.check_tag.outputs.exists == 'false')) &&
198-
(steps.publish_trusted.outcome == 'failure' || steps.publish_trusted.outcome == 'cancelled') &&
199-
secrets.PYPI_API_TOKEN
198+
(steps.publish_trusted.outcome == 'failure' || steps.publish_trusted.outcome == 'cancelled')
200199
env:
201200
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
202201
run: |
202+
if [ -z "$UV_PUBLISH_TOKEN" ]; then
203+
echo "PYPI_API_TOKEN secret is not set, skipping UV publish fallback"
204+
exit 0
205+
fi
203206
echo "Trusted publishing failed, using UV with API token as fallback"
204207
uv publish --token "$UV_PUBLISH_TOKEN"
205208

0 commit comments

Comments
 (0)