ci: Add deployment job to workflow #376
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: reactive_forms | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- "feature/**" | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
- develop | |
jobs: | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.16.0" | |
channel: "stable" | |
- run: flutter pub get | |
- run: flutter test --no-pub --coverage | |
- run: bash <(curl -s https://codecov.io/bash) -t d5f3f780-d3d4-4c7c-997b-31f1f7620eba | |
analyze: | |
name: Analyze | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.16.0" | |
channel: "stable" | |
- run: flutter pub get | |
- name: Analyze lib | |
run: flutter analyze lib | |
- name: Analyze test | |
run: flutter analyze test | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.16.0" | |
channel: "stable" | |
- run: flutter pub get | |
- name: Format lib | |
run: dart format lib --set-exit-if-changed | |
- name: Format test | |
run: dart format test --set-exit-if-changed | |
publish-warnings: | |
name: Publish warnings | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.16.0" | |
channel: "stable" | |
- run: flutter pub get | |
- name: Check publish warnings | |
run: dart pub publish --dry-run | |
deployment: | |
if: ${{ github.ref_type == 'tag' }} | |
needs: [test, analyze, format, publish-warnings] | |
name: Deploy package | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure enviroment | |
uses: actions/checkout@v3 | |
- name: Download flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.16.0" | |
channel: "stable" | |
- name: Setup pub credentials | |
shell: bash | |
env: | |
PUB_DEV_PUBLISH_ACCESS_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_ACCESS_TOKEN }} | |
PUB_DEV_PUBLISH_REFRESH_TOKEN: ${{ secrets.PUB_DEV_PUBLISH_REFRESH_TOKEN }} | |
run: | | |
sh ./tool/pub_login.sh | |
- name: Publish package | |
run: dart pub publish -v -f |