From c294b62827ef185efb311af377807308815082e3 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Tue, 9 May 2023 18:37:35 +0800 Subject: [PATCH] fix: error occurs when publishing using trusted publisher. Related #1868 Signed-off-by: Frost Ming --- news/1868.bugfix.md | 1 + news/1904.bugfix.md | 1 + src/pdm/cli/commands/publish/repository.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 news/1868.bugfix.md create mode 100644 news/1904.bugfix.md diff --git a/news/1868.bugfix.md b/news/1868.bugfix.md new file mode 100644 index 0000000000..5428ebd8e5 --- /dev/null +++ b/news/1868.bugfix.md @@ -0,0 +1 @@ +Fix the error when publishing using trusted publisher. diff --git a/news/1904.bugfix.md b/news/1904.bugfix.md new file mode 100644 index 0000000000..73e96f0ea1 --- /dev/null +++ b/news/1904.bugfix.md @@ -0,0 +1 @@ +Fix a bug that `PATH` env var isn't set correctly when running under non-isolation mode. diff --git a/src/pdm/cli/commands/publish/repository.py b/src/pdm/cli/commands/publish/repository.py index b15d8f2860..55b5d1faef 100644 --- a/src/pdm/cli/commands/publish/repository.py +++ b/src/pdm/cli/commands/publish/repository.py @@ -34,10 +34,10 @@ def __init__( if ca_certs is not None: self.session.set_ca_certificates(pathlib.Path(ca_certs)) self._credentials_to_save: tuple[str, str, str] | None = None + self.ui = project.core.ui username, password = self._ensure_credentials(username, password) self.session.auth = (username, password) weakref.finalize(self, self.session.close) - self.ui = project.core.ui def _ensure_credentials(self, username: str | None, password: str | None) -> tuple[str, str]: netloc = urlparse(self.url).netloc