Skip to content

Commit 41baa55

Browse files
committed
Add ci
1 parent a698fdf commit 41baa55

1 file changed

Lines changed: 105 additions & 0 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: CI & CD
2+
3+
on:
4+
workflow_dispatch:
5+
6+
push:
7+
branches: [main]
8+
tags:
9+
- "[0-9]+.[0-9]+.[0-9]+*"
10+
11+
pull_request:
12+
branches: [main]
13+
14+
# This ensures that previous jobs for the PR are canceled when PR is updated
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build:
21+
name: Build package & run tests
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 1 # Use shallow clone for faster checkout
29+
30+
- name: Check broken links
31+
uses: JustinBeckwith/linkinator-action@v1
32+
with:
33+
paths: "**/*.md"
34+
35+
- name: Set up Flutter
36+
uses: subosito/flutter-action@v2
37+
with:
38+
channel: "stable"
39+
architecture: x64
40+
cache: true
41+
42+
- name: Install dependencies
43+
run: dart pub get
44+
45+
- name: Format code
46+
run: dart format --set-exit-if-changed .
47+
48+
- name: Analyze static code
49+
run: dart analyze
50+
51+
- name: Check publish warnings
52+
run: dart pub publish --dry-run
53+
54+
example-android:
55+
name: Build Android example app
56+
runs-on: ubuntu-latest
57+
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v4
61+
with:
62+
fetch-depth: 1 # Use shallow clone for faster checkout
63+
64+
- name: Set up Flutter
65+
uses: subosito/flutter-action@v2
66+
with:
67+
channel: "stable"
68+
architecture: x64
69+
cache: true
70+
71+
- name: Install dependencies
72+
run: dart pub get
73+
74+
- name: Build example
75+
run: flutter build appbundle --debug
76+
working-directory: example
77+
78+
deployment:
79+
if: ${{ github.ref_type == 'tag' }}
80+
needs: [build, example-android]
81+
name: Deploy package
82+
permissions:
83+
id-token: write
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Checkout repository
87+
uses: actions/checkout@v4
88+
with:
89+
fetch-depth: 1 # Use shallow clone for faster checkout
90+
91+
- name: Set up Dart
92+
uses: dart-lang/setup-dart@v1
93+
94+
- name: Set up Flutter
95+
uses: subosito/flutter-action@v2
96+
with:
97+
channel: "stable"
98+
architecture: x64
99+
cache: true
100+
101+
- name: Install dependencies
102+
run: dart pub get
103+
104+
- name: Publish package
105+
run: dart pub publish -v -f

0 commit comments

Comments
 (0)