diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5fdce0c..c21a040 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,5 +1,5 @@ # .github/workflows/publish.yml -name: Publish to pub.dev +name: Analyze and publish to pub.dev on: push: @@ -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 \ No newline at end of file + 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