|
| 1 | +name: Base |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + tags: |
| 7 | + - '*' |
| 8 | + |
| 9 | + pull_request: |
| 10 | + branches: [main] |
| 11 | + |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: macos-latest |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + channel: [stable, beta] |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v3 |
| 24 | + |
| 25 | + - name: Check broken links |
| 26 | + uses: JustinBeckwith/linkinator-action@v1 |
| 27 | + with: |
| 28 | + paths: "**/*.md" |
| 29 | + |
| 30 | + - name: Flutter action |
| 31 | + uses: subosito/flutter-action@v2 |
| 32 | + with: |
| 33 | + channel: ${{ matrix.channel }} |
| 34 | + |
| 35 | + - name: Install dependencies |
| 36 | + run: flutter pub get |
| 37 | + - name: Format code |
| 38 | + run: flutter format --dry-run --set-exit-if-changed . |
| 39 | + - name: Analyze static code |
| 40 | + run: flutter analyze |
| 41 | + - name: Run tests |
| 42 | + run: flutter test |
| 43 | + - name: Check publish warnings |
| 44 | + run: dart pub publish --dry-run |
| 45 | + - name: Build example |
| 46 | + run: | |
| 47 | + cd example |
| 48 | + flutter build appbundle --debug |
| 49 | + flutter build ios --debug --no-codesign |
| 50 | +
|
| 51 | + - name: Upload coverage to Codecov |
| 52 | + if: ${{ matrix.channel == 'stable' }} |
| 53 | + uses: codecov/codecov-action@v3 |
| 54 | + with: |
| 55 | + files: coverage/lcov.info |
| 56 | + flags: unittests |
| 57 | + name: form_builder_phone_field |
| 58 | + |
| 59 | + deployment: |
| 60 | + if: ${{ github.ref_type == 'tag' }} |
| 61 | + needs: build |
| 62 | + name: Deploy package |
| 63 | + runs-on: ubuntu-latest |
| 64 | + |
| 65 | + steps: |
| 66 | + - name: Configure enviroment |
| 67 | + uses: actions/checkout@v3 |
| 68 | + - name: Download flutter |
| 69 | + uses: subosito/flutter-action@v2 |
| 70 | + with: |
| 71 | + channel: 'stable' |
| 72 | + - name: Setup pub credentials |
| 73 | + shell: bash |
| 74 | + env: |
| 75 | + PUB_DEV_PUBLISH_ACCESS_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }} |
| 76 | + PUB_DEV_PUBLISH_REFRESH_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }} |
| 77 | + run: | |
| 78 | + sh ./tools/pub_login.sh |
| 79 | + - name: Publish package |
| 80 | + run: | |
| 81 | + pushd packages/form_builder_phone_field |
| 82 | + dart pub publish -v -f |
0 commit comments