Add ci
keypair34 committed
Apr 5, 2026 at 16:14 UTC
eb7a7fdc4163cb814f63a7d94892bb5a56768141
2 files changed
+114
-1
.github/workflows/release-sdk-dart.yml
new
+113
@@ -0,0 +1,113 @@
1
+name: Release SDK Dart
2
+
3
+on:
4
+ push:
5
+ tags:
6
+ - "[0-9]+.[0-9]+.[0-9]+"
7
+ workflow_dispatch:
8
+
9
+permissions:
10
+ contents: write
11
+
12
+jobs:
13
+ # ── Validate (every run) ──────────────────────────────────────────────────
14
+ validate:
15
+ name: Validate
16
+ runs-on: ubuntu-latest
17
+
18
+ outputs:
19
+ version: ${{ steps.meta.outputs.version }}
20
+
21
+ steps:
22
+ - name: Checkout
23
+ uses: actions/checkout@v6
24
+
25
+ - name: Set up Flutter
26
+ uses: subosito/flutter-action@v2
27
+ with:
28
+ flutter-version: "3.27.x"
29
+ channel: stable
30
+ cache: true
31
+
32
+ # ── Read version ───────────────────────────────────────────────────────
33
+
34
+ - name: Read version from pubspec.yaml
35
+ id: meta
36
+ working-directory: sdk/dart
37
+ run: |
38
+ VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}')
39
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
40
+ echo "Dart SDK version: $VERSION"
41
+
42
+ # ── Validate tag = pubspec version (tag push only) ─────────────────────
43
+
44
+ - name: Validate tag matches pubspec.yaml version
45
+ if: startsWith(github.ref, 'refs/tags/')
46
+ env:
47
+ PUBSPEC_VERSION: ${{ steps.meta.outputs.version }}
48
+ TAG: ${{ github.ref_name }}
49
+ run: |
50
+ if [ "$TAG" != "$PUBSPEC_VERSION" ]; then
51
+ echo "::error::Tag '$TAG' does not match pubspec.yaml version '$PUBSPEC_VERSION'. Update pubspec.yaml or re-tag."
52
+ exit 1
53
+ fi
54
+ echo "Version check passed: $PUBSPEC_VERSION"
55
+
56
+ # ── Lint & dry-run ────────────────────────────────────────────────────
57
+
58
+ - name: Install dependencies
59
+ working-directory: sdk/dart
60
+ run: flutter pub get
61
+
62
+ - name: Analyze
63
+ working-directory: sdk/dart
64
+ # --no-fatal-infos: flutter_rust_bridge codegen files emit infos that
65
+ # are intentionally excluded from analysis_options.yaml but the glob
66
+ # does not cover the frb_generated.dart/ directory structure.
67
+ run: flutter analyze --no-fatal-infos
68
+
69
+ - name: Dry-run publish
70
+ working-directory: sdk/dart
71
+ run: flutter pub publish --dry-run
72
+
73
+ # ── Publish to pub.dev (tag push only) ────────────────────────────────────
74
+ publish:
75
+ name: Publish to pub.dev
76
+ needs: validate
77
+ runs-on: ubuntu-latest
78
+ if: startsWith(github.ref, 'refs/tags/')
79
+
80
+ steps:
81
+ - name: Checkout
82
+ uses: actions/checkout@v6
83
+
84
+ - name: Set up Flutter
85
+ uses: subosito/flutter-action@v2
86
+ with:
87
+ flutter-version: "3.27.x"
88
+ channel: stable
89
+ cache: true
90
+
91
+ - name: Install dependencies
92
+ working-directory: sdk/dart
93
+ run: flutter pub get
94
+
95
+ # ── Authenticate with pub.dev ─────────────────────────────────────────
96
+ # PUB_CREDENTIALS must be a repository secret containing the full JSON
97
+ # content of ~/.pub-cache/credentials.json obtained from a machine that
98
+ # has already run `dart pub login` (or `flutter pub login`) and authorised
99
+ # the ondeinference pub.dev publisher account.
100
+ #
101
+ # To obtain the credentials:
102
+ # 1. Run `dart pub login` on a local machine.
103
+ # 2. Copy the contents of ~/.pub-cache/credentials.json.
104
+ # 3. Add it as a repository secret named PUB_CREDENTIALS.
105
+ - name: Set up pub.dev credentials
106
+ run: |
107
+ mkdir -p ~/.pub-cache
108
+ echo '${{ secrets.PUB_CREDENTIALS }}' > ~/.pub-cache/credentials.json
109
+
110
+ # ── Publish ────────────────────────────────────────────────────────────
111
+ - name: Publish onde_inference to pub.dev
112
+ working-directory: sdk/dart
113
+ run: flutter pub publish --force
.github/workflows/release-sdk-swift.yml
+1
-1
@@ -1,4 +1,4 @@
1
-name: Release SDK (Swift)
1
+name: Release SDK Swift
2
3
on:
4
push: