Skip to content

Commit

Permalink
fix PUB_TOKEN request
Browse files Browse the repository at this point in the history
  • Loading branch information
eseidel committed Jul 25, 2024
1 parent 07d7762 commit 6ce023e
Showing 1 changed file with 10 additions and 32 deletions.
42 changes: 10 additions & 32 deletions .github/actions/publish_flutter_package/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,17 @@ runs:
- 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
- name: ☎️ Install OIDC Client from Core Package
shell: ${{ inputs.shell }}
run: |
curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://pub.dev/"
run: npm install @actions/core@1.6.0 @actions/http-client

- name: 🪪 Get Id Token
uses: actions/github-script@v6
with:
script: |
const core = require('@actions/core')
let pub_token = await core.getIDToken('https://pub.dev/')
core.setOutput('PUB_TOKEN', pub_token)
- name: 📢 Authenticate
shell: ${{ inputs.shell }}
Expand Down

0 comments on commit 6ce023e

Please sign in to comment.