Skip to content

Commit

Permalink
Attempt to auth to pub
Browse files Browse the repository at this point in the history
  • Loading branch information
eseidel committed Jul 25, 2024
1 parent 3c6712d commit 07d7762
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/actions/publish_flutter_package/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,45 @@ runs:
uses: actions/checkout@v4
- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2

# Future<void> createPubOIDCToken() async {
# final tokenRequestUrl = process.env('ACTIONS_ID_TOKEN_REQUEST_URL');
# final tokenRequestToken = process.env('ACTIONS_ID_TOKEN_REQUEST_TOKEN');

# if (tokenRequestUrl == null || tokenRequestToken == null) {
# return;
# }

# final token =
# await promiseToFuture<String>(core.getIDToken('https://pub.dev'));

# core.exportVariable('PUB_TOKEN', token);

# await promiseToFuture<void>(exec.exec(
# 'dart',
# [
# 'pub'.toJS,
# 'token'.toJS,
# 'add'.toJS,
# 'https://pub.dev'.toJS,
# '--env-var'.toJS,
# 'PUB_TOKEN'.toJS,
# ].toJS,
# ));
# }
# Get the token and put it in the PUB_TOKEN environment variable
# curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://pub.dev/"
# flutter pub pub token add --host https://pub.dev --env-var PUB_TOKEN

- name: Get OIDC token
shell: ${{ inputs.shell }}
run: |
curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://pub.dev/"
- name: 📢 Authenticate
shell: ${{ inputs.shell }}
run: flutter pub pub token add --host https://pub.dev --env-var PUB_TOKEN

- name: 📦 Install dependencies
shell: ${{ inputs.shell }}
run: flutter pub get
Expand Down

0 comments on commit 07d7762

Please sign in to comment.