name: Publish package to pub.dev
on:
  push:
    tags:
      - v*
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: subosito/flutter-action@v1
        with:
          channel: 'stable'
      - run: flutter pub get
      - run: flutter pub run tool/publish/comment_dependency_overrides.dart
      - run: flutter pub get
      - run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF}
      - run: flutter pub run tool/publish/check_version.dart ${{ env.RELEASE_VERSION }}
      - name: Setup credentials
        run: |
          mkdir -p ~/.pub-cache
          cat <<EOF > ~/.pub-cache/credentials.json
          {
            "accessToken":"${{ secrets.OAUTH_ACCESS_TOKEN }}",
            "refreshToken":"${{ secrets.OAUTH_REFRESH_TOKEN }}",
            "tokenEndpoint":"https://accounts.google.com/o/oauth2/token",
            "scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ],
            "expiration": 1570721159347
          }
          EOF
      - name: Publish package
        run: flutter pub publish --dry-run

name: Publish package to pub.dev
on:
  push:
    tags:
      - v*
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: subosito/flutter-action@v1
        with:
          channel: 'stable'
      - run: flutter pub get
      - run: flutter pub run tool/publish/comment_dependency_overrides.dart
      - run: flutter pub get
      - run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF}
      - run: flutter pub run tool/publish/check_version.dart ${{ env.RELEASE_VERSION }}
      - name: Setup credentials
        run: |
          mkdir -p ~/.pub-cache
          cat <<EOF > ~/.pub-cache/credentials.json
          {
            "accessToken":"${{ secrets.OAUTH_ACCESS_TOKEN }}",
            "refreshToken":"${{ secrets.OAUTH_REFRESH_TOKEN }}",
            "tokenEndpoint":"https://accounts.google.com/o/oauth2/token",
            "scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ],
            "expiration": 1570721159347
          }
          EOF
      - name: Publish package
        run: flutter pub publish --force

Enable the auto publishing on pub
Enable the auto publishing on pub

