This is an automated email from the ASF dual-hosted git repository.

erickguan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new f6939d13a fix(ci): use NuGet login action instead of manual login 
nuget (#7903)
f6939d13a is described below

commit f6939d13a2bdf2c77b3ce33210410679430b5a04
Author: Fatorin <[email protected]>
AuthorDate: Mon Jul 13 09:00:45 2026 +0800

    fix(ci): use NuGet login action instead of manual login nuget (#7903)
---
 .github/workflows/release_dotnet.yml | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)

diff --git a/.github/workflows/release_dotnet.yml 
b/.github/workflows/release_dotnet.yml
index b84ebaef5..46693bca4 100644
--- a/.github/workflows/release_dotnet.yml
+++ b/.github/workflows/release_dotnet.yml
@@ -197,26 +197,9 @@ jobs:
 
       - name: NuGet login
         id: login
-        shell: bash
-        env:
-          NUGET_USERNAME: Apache.OpenDAL
-        run: |
-          oidc_token="$(curl -fsSL \
-            -H "Authorization: Bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" \
-            
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=https%3A%2F%2Fwww.nuget.org" \
-            | python3 -c 'import json, sys; 
print(json.load(sys.stdin)["value"])')"
-          echo "::add-mask::${oidc_token}"
-
-          request_body="$(python3 -c 'import json, os; 
print(json.dumps({"username": os.environ["NUGET_USERNAME"], "tokenType": 
"ApiKey"}))')"
-          api_key="$(curl -fsSL \
-            -X POST https://www.nuget.org/api/v2/token \
-            -H "Content-Type: application/json" \
-            -H "Authorization: Bearer ${oidc_token}" \
-            -H "User-Agent: apache-opendal-release" \
-            --data "${request_body}" \
-            | python3 -c 'import json, sys; 
print(json.load(sys.stdin)["apiKey"])')"
-          echo "::add-mask::${api_key}"
-          echo "NUGET_API_KEY=${api_key}" >> "${GITHUB_OUTPUT}"
+        uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2.0
+        with:
+          user: Apache.OpenDAL
 
       - name: Publish package
-        run: dotnet nuget push bindings/dotnet/artifacts/package/*.nupkg 
--api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source 
https://api.nuget.org/v3/index.json --skip-duplicate
+        run: dotnet nuget push bindings/dotnet/artifacts/package/*.nupkg 
--api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source 
https://api.nuget.org/v3/index.json

Reply via email to