File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -104,3 +104,17 @@ echo "${RUNNER_TOOL_CACHE}/dart-sdk/bin" >> $GITHUB_PATH
104104# Report success, and print version.
105105echo -e " Successfully installed Dart SDK:"
106106${RUNNER_TOOL_CACHE} /dart-sdk/bin/dart --version
107+
108+ # When enabled through env variables, create OIDC token for publishing on pub.dev.
109+ if [[ " ${ACTIONS_ID_TOKEN_REQUEST_URL} " != " " && " ${ACTIONS_ID_TOKEN_REQUEST_TOKEN} " != " " ]]
110+ then
111+ if [[ -x " $( command -v jq) " ]]
112+ then
113+ PUB_TOKEN=$( curl --retry 5 --retry-connrefused -sLS " ${ACTIONS_ID_TOKEN_REQUEST_URL} &audience=https://pub.dev" -H " User-Agent: actions/oidc-client" -H " Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN " | jq -r ' .value' )
114+ echo " PUB_TOKEN=${PUB_TOKEN} " >> $GITHUB_ENV
115+ export PUB_TOKEN
116+ ${RUNNER_TOOL_CACHE} /dart-sdk/bin/dart pub token add https://pub.dev --env-var PUB_TOKEN
117+ else
118+ echo " Could not setup OIDC token, 'jq' is not available." ;
119+ fi
120+ fi
You can’t perform that action at this time.
0 commit comments