From a5c8e6f3105bc4d986903676382b0c13e9d13420 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 25 Mar 2024 02:13:53 +0800 Subject: [PATCH] add GitHub Actions configuration to automatically publish to pub.dev from Github --- .github/workflows/publish.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..8b81b80 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +name: Publish to pub.dev + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+*' + +jobs: + publish: + name: Publish to pub.dev + runs-on: ubuntu-latest + environment: pub.dev + permissions: + id-token: write # Required for authentication using OIDC + steps: + # Checkout repository + - name: Checkout repository + uses: actions/checkout@v4 + # This action adds a token needed for pub.dev + - name: Install Dart + uses: dart-lang/setup-dart@v1 + with: + sdk: stable + # Install Flutter + - name: Install Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + # Minimal package setup and dry run checks. + - name: Install dependencies + run: flutter pub get + # Publish package with dry run + - name: Publish dry run + run: flutter pub publish --dry-run + # Publishing... + - name: Publish to pub.dev + run: flutter pub publish -f