{"id":271004,"date":"2023-05-10T09:00:20","date_gmt":"2023-05-10T01:00:20","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=271004"},"modified":"2023-04-30T14:47:15","modified_gmt":"2023-04-30T06:47:15","slug":"pypl-linux-trusted","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/pypl-linux-trusted.html","title":{"rendered":"PyPI \u5f15\u5165 ‘Trusted Publishers’\uff08\u53ef\u4fe1\u53d1\u5e03\uff09\u673a\u5236"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nPyPI \u5b98\u65b9\u5ba3\u5e03\uff0c\u4ece\u4eca\u5929\u5f00\u59cb\u4ed6\u4eec\u5f15\u5165\u4e86'Trusted Publishers'\uff08\u53ef\u4fe1\u53d1\u5e03\uff09\u673a\u5236\uff0cPyPI \u5305\u7ef4\u62a4\u8005\u53ef\u4ee5\u91c7\u7528\u4e00\u79cd\u65b0\u7684\u3001\u66f4\u5b89\u5168\u7684\u53d1\u5e03\u65b9\u6cd5\uff0c\u4e0d\u9700\u8981\u4e0e\u5916\u90e8\u7cfb\u7edf\u5171\u4eab\u957f\u671f\u5bc6\u7801\u6216 API \u4ee4\u724c\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u636e\u4ecb\u7ecd\uff0c\u201c\u53ef\u4fe1\u53d1\u5e03\u201d \u662f\u4f7f\u7528 OpenID Connect (OIDC) \u6807\u51c6\u5728\u53ef\u4fe1\u7b2c\u4e09\u65b9\u670d\u52a1\u548c PyPI \u4e4b\u95f4\u4ea4\u6362\u77ed\u671f\u8eab\u4efd\u4ee4\u724c\u7684\u672f\u8bed\u3002\u6b64\u65b9\u6cd5\u53ef\u7528\u4e8e\u81ea\u52a8\u5316\u73af\u5883\uff0c\u5728\u53d1\u5e03\u65f6\u65e0\u9700\u4f7f\u7528\u7528\u6237\u540d \/ \u5bc6\u7801\u7ec4\u5408\u6216\u624b\u52a8\u751f\u6210\u7684 API \u4ee4\u724c\u901a\u8fc7 PyPI \u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\u3002<\/p>\n

PyPI \u7ef4\u62a4\u8005\u53ef\u4ee5\u5c06 PyPI \u914d\u7f6e\u4e3a\u4fe1\u4efb\u7ed9\u5b9a OpenID Connect \u8eab\u4efd\u63d0\u4f9b\u8005 (IdP) \u63d0\u4f9b\u7684\u8eab\u4efd\u3002\u8fd9\u5141\u8bb8 PyPI \u9a8c\u8bc1\u8eab\u4efd\u5e76\u5c06\u4fe1\u4efb\u59d4\u6258\u7ed9\u8be5\u8eab\u4efd\uff0c\u7136\u540e\u6388\u6743\u8be5\u8eab\u4efd\u4ece PyPI \u8bf7\u6c42\u77ed\u671f\u7684\u3001\u8303\u56f4\u4e25\u683c\u7684 API \u4ee4\u724c\u3002\u8fd9\u4e9b API \u4ee4\u724c\u6c38\u8fdc\u4e0d\u9700\u8981\u5b58\u50a8\u6216\u5171\u4eab\uff0c\u901a\u8fc7\u5feb\u901f\u8fc7\u671f\u81ea\u52a8\u8f6e\u6362\uff0c\u5e76\u5728\u5df2\u53d1\u5e03\u7684\u5305\u53ca\u5176\u6765\u6e90\u4e4b\u95f4\u63d0\u4f9b\u53ef\u9a8c\u8bc1\u7684\u94fe\u63a5\u3002<\/p>\n

PyPI \u4ecb\u7ecd\u4e86\u901a\u8fc7 GitHub Actions \u4f7f\u7528\u53ef\u4fe1\u53d1\u5e03\u673a\u5236\u7684\u65b9\u5f0f\uff1a<\/p>\n

jobs:\r\n   pypi-publish:\r\n     name: upload release to PyPI\r\n     runs-on: ubuntu-latest\r\n+    permissions:\r\n+      # IMPORTANT: this permission is mandatory for trusted publishing\r\n+      id-token: write\r\n     steps:\r\n       # retrieve your distributions here\r\n\r\n       - name: Publish package distributions to PyPI\r\n         uses: pypa\/gh-action-pypi-publish@release\/v1\r\n-        with:\r\n-          username: __token__\r\n-          password: ${{ secrets.PYPI_TOKEN }}<\/pre>\n

\u8be6\u7ec6\u4f7f\u7528\u65b9\u6cd5\u67e5\u770b\u6587\u6863\uff1ahttps:\/\/docs.pypi.org\/trusted-publishers\/ <\/p>\n","protected":false},"excerpt":{"rendered":"

\u636e\u4ecb\u7ecd\uff0c\u201c\u53ef\u4fe1\u53d1\u5e03\u201d \u662f\u4f7f\u7528 OpenID Connect (OIDC) \u6807\u51c6\u5728\u53ef\u4fe1\u7b2c\u4e09\u65b9\u670d\u52a1\u548c PyPI \u4e4b […]<\/p>\n","protected":false},"author":1482,"featured_media":222003,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[21],"tags":[],"class_list":["post-271004","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/271004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1482"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=271004"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/271004\/revisions"}],"predecessor-version":[{"id":271215,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/271004\/revisions\/271215"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/222003"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=271004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=271004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=271004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}