Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions .github/workflows/release_dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading