-
-
Notifications
You must be signed in to change notification settings - Fork 328
76 lines (64 loc) · 1.88 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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