name: Publish to pub.dev

on:
  push:
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+*'

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      id-token: write

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Install Dart
        uses: dart-lang/setup-dart@v1
        with:
          sdk: stable

      - name: "Install Flutter"
        uses: subosito/flutter-action@v2
        with:
          channel: "stable"
          cache: true

      - name: Get all Flutter Packages
        run: flutter pub get

      - name: Publish to pub.dev
        run: flutter pub publish --force
