Update README.md (#536) #839
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: Test and Publish | |
on: | |
push: | |
branches: ['*'] | |
tags: ['v*','V*'] | |
pull_request: | |
branches: ['*'] | |
tags: ['v*','V*'] | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: '12.x' | |
- uses: subosito/flutter-action@v1 | |
with: | |
channel: 'stable' # or: 'dev' or 'beta' | |
- name: Install packages dependencies | |
run: flutter pub get | |
- name: Analyze the project's Dart code | |
run: flutter analyze | |
- name: Run tests | |
run: flutter test | |
- name: Run tests coverage | |
run: flutter test --coverage | |
publish: | |
if: "(contains(github.event.head_commit.message, '[pub]') && | |
contains(' | |
refs/heads/master | |
refs/heads/develop | |
refs/tags | |
refs/tags/releases', | |
github.ref)) || | |
startsWith(' | |
refs/tags/ | |
refs/tags/releases/', | |
github.ref)" | |
name: Publish | |
permissions: | |
id-token: write # This is required for authentication using OIDC | |
needs: [test] | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run a one-line script | |
id: vars | |
run: echo "pkg_tag=$(cat pubspec.yaml | grep version | head -1 | awk -F= "{ print $2 }" | sed 's/[version:,\",]//g' | tr -d '[[:space:]]')" >> $GITHUB_OUTPUT | |
- uses: dart-lang/setup-dart@v1 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
- name: Add pub token | |
run: echo ${{secrets.OAUTH_ACCESS_TOKEN}} | dart pub token add https://pub.dev | |
- name: Install dependencies | |
run: dart pub get | |
- name: code format | |
run: dart format lib/*/*.dart lib/*.dart | |
- name: Publish pkg | |
run: dart pub publish --server=https://pub.dartlang.org -f |