From 0da28df2f8743b82c990a0cc7f9412084e26865f Mon Sep 17 00:00:00 2001 From: Kim Gustyr Date: Mon, 21 Oct 2024 12:19:38 +0100 Subject: [PATCH] fix(ci): Incorrect publish workflow for Flutter --- .../{publish_master.yml => publish.yml} | 22 ++++++++++++++++--- .github/workflows/pull-request.yml | 2 +- 2 files changed, 20 insertions(+), 4 deletions(-) rename .github/workflows/{publish_master.yml => publish.yml} (50%) diff --git a/.github/workflows/publish_master.yml b/.github/workflows/publish.yml similarity index 50% rename from .github/workflows/publish_master.yml rename to .github/workflows/publish.yml index d8a57bd..08e8722 100644 --- a/.github/workflows/publish_master.yml +++ b/.github/workflows/publish.yml @@ -8,6 +8,7 @@ env: FLUTTER_VERSION: '3.x' jobs: + # TODO https://github.com/Flagsmith/flagsmith-flutter-client/issues/57 analyze: runs-on: ubuntu-latest name: Dart Analyze @@ -20,9 +21,24 @@ jobs: - run: flutter pub get - run: flutter analyze - # TODO https://github.com/Flagsmith/flagsmith-flutter-client/issues/57 - publish: permissions: id-token: write - uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Flutter + uses: subosito/flutter-action@v2 + + - name: Get pub.dev token + uses: actions/github-script@v6 + with: + script: | + let pub_token = await core.getIDToken('https://pub.dev') + core.exportVariable('PUB_TOKEN', pub_token) + + - name: Publish + run: | + flutter pub pub token add https://pub.dev --env-var PUB_TOKEN + flutter pub publish diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 00ec874..1eb7c4f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -40,7 +40,7 @@ jobs: # TODO https://github.com/Flagsmith/flagsmith-flutter-client/issues/57 - publishing: + publish-dry-run: runs-on: ubuntu-latest name: Dart Publish Package Test needs: tests