Skip to content

Commit

Permalink
workflows: Publish using Flutter
Browse files Browse the repository at this point in the history
  • Loading branch information
cadivus committed Oct 21, 2024
1 parent c27ba69 commit 4fb741a
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# .github/workflows/publish.yml
name: Publish to pub.dev
name: Analyze and publish to pub.dev

on:
push:
Expand All @@ -17,6 +17,18 @@ jobs:
publish:
permissions:
id-token: write # Required for authentication using OIDC
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
# with:
# working-directory: path/to/package/within/repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: stable
- run: flutter pub get
- name: Create publishing token (flutter)
run: |
set -eo pipefail
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')
echo "PUB_TOKEN=${PUB_TOKEN}" >> $GITHUB_ENV
export PUB_TOKEN
flutter pub token add https://pub.dev --env-var PUB_TOKEN
- run: flutter pub publish

0 comments on commit 4fb741a

Please sign in to comment.