Skip to content

Commit 51a8a7b

Browse files
authored
Merge pull request #20 from VapiAI/sri/update-publishing
added new publishing steps
2 parents 5959f47 + cc345d5 commit 51a8a7b

File tree

7 files changed

+294
-90
lines changed

7 files changed

+294
-90
lines changed

.github/workflows/ci.yml

Lines changed: 85 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,102 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
12-
11+
name: Test on ${{ matrix.os }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
include:
17+
- os: ubuntu-latest
18+
flutter_path: /opt/hostedtoolcache/flutter
19+
- os: macos-latest
20+
flutter_path: /Users/runner/hostedtoolcache/flutter
21+
- os: windows-latest
22+
flutter_path: C:\hostedtoolcache\windows\flutter
23+
1324
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v4
16-
25+
- uses: actions/checkout@v4
26+
1727
- name: Setup Flutter
1828
uses: subosito/flutter-action@v2
1929
with:
2030
flutter-version: '3.27.0'
2131
channel: 'stable'
22-
32+
2333
- name: Install dependencies
2434
run: flutter pub get
25-
26-
- name: Analyze code
35+
36+
- name: Verify formatting
37+
run: dart format --output=none --set-exit-if-changed .
38+
39+
- name: Analyze project source
2740
run: flutter analyze
28-
29-
# - name: Run tests
30-
# run: flutter test
31-
32-
- name: Check formatting
33-
run: dart format --set-exit-if-changed .
34-
35-
- name: Check publish readiness
41+
42+
- name: Run tests
43+
run: flutter test
44+
45+
- name: Check pub score
46+
run: |
47+
dart pub global activate pana
48+
echo "Running pana analysis..."
49+
dart pub global run pana --no-warning --exit-code-threshold 10
50+
echo ""
51+
echo "Note: permission_handler is constrained to ^11.3.1 by daily_flutter 0.31.0"
52+
echo "This causes a 10-point deduction in the pub score."
53+
54+
example:
55+
name: Build example app
56+
runs-on: ubuntu-latest
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: Setup Flutter
62+
uses: subosito/flutter-action@v2
63+
with:
64+
flutter-version: '3.27.0'
65+
channel: 'stable'
66+
67+
- name: Install dependencies (root)
68+
run: flutter pub get
69+
70+
- name: Install dependencies (example)
71+
run: |
72+
cd example
73+
flutter pub get
74+
75+
- name: Build Android APK
76+
run: |
77+
cd example
78+
flutter build apk --debug
79+
80+
- name: Build iOS (simulator only)
81+
if: matrix.os == 'macos-latest'
82+
run: |
83+
cd example
84+
flutter build ios --debug --simulator
85+
86+
publish-dry-run:
87+
name: Publish dry run
88+
runs-on: ubuntu-latest
89+
90+
steps:
91+
- uses: actions/checkout@v4
92+
93+
- name: Setup Flutter
94+
uses: subosito/flutter-action@v2
95+
with:
96+
flutter-version: '3.27.0'
97+
channel: 'stable'
98+
99+
- name: Install dependencies
100+
run: flutter pub get
101+
102+
- name: Publish dry run
36103
run: flutter pub publish --dry-run

.github/workflows/publish.yml

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,12 @@
11
name: Publish to pub.dev
22

33
on:
4-
release:
5-
types: [published]
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
67

78
jobs:
89
publish:
9-
runs-on: ubuntu-latest
10-
11-
steps:
12-
- name: Checkout code
13-
uses: actions/checkout@v4
14-
15-
- name: Setup Flutter
16-
uses: subosito/flutter-action@v2
17-
with:
18-
flutter-version: '3.27.0'
19-
channel: 'stable'
20-
21-
- name: Verify version consistency
22-
run: |
23-
# Extract version from pubspec.yaml
24-
PUBSPEC_VERSION=$(grep '^version: ' pubspec.yaml | sed 's/version: //')
25-
# Remove 'v' prefix from tag if present
26-
TAG_VERSION=${GITHUB_REF_NAME#v}
27-
28-
echo "Tag version: $TAG_VERSION"
29-
echo "Pubspec version: $PUBSPEC_VERSION"
30-
31-
if [ "$TAG_VERSION" != "$PUBSPEC_VERSION" ]; then
32-
echo "Error: Tag version ($TAG_VERSION) does not match pubspec.yaml version ($PUBSPEC_VERSION)"
33-
echo "Please ensure your tag matches the version in pubspec.yaml"
34-
exit 1
35-
fi
36-
37-
echo "✓ Version check passed!"
38-
39-
- name: Install dependencies
40-
run: flutter pub get
41-
42-
- name: Setup Dart credentials
43-
run: |
44-
mkdir -p ~/.pub-cache
45-
echo '${{ secrets.PUB_CREDENTIALS }}' > ~/.pub-cache/credentials.json
46-
47-
- name: Verify package scores
48-
run: |
49-
echo "Running package verification..."
50-
flutter pub publish --dry-run
51-
52-
- name: Publish to pub.dev
53-
run: |
54-
# Using --force because this runs in CI without user interaction
55-
# The dry-run above ensures the package is valid before publishing
56-
flutter pub publish --force
10+
permissions:
11+
id-token: write # Required for authentication using OIDC
12+
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Vapi Flutter SDK
22

3+
[![CI](https://github.com/VapiAI/vapi-client-sdk-flutter/actions/workflows/ci.yml/badge.svg)](https://github.com/VapiAI/vapi-client-sdk-flutter/actions/workflows/ci.yml)
4+
[![pub package](https://img.shields.io/pub/v/vapi.svg)](https://pub.dev/packages/vapi)
5+
36
## Minimum requirements
47

58
### Mobile

RELEASE.md

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@ This guide explains how to release new versions of the Vapi Flutter SDK to pub.d
44

55
## Initial Setup (One-time)
66

7-
### 1. Get pub.dev credentials
7+
### Enable Automated Publishing on pub.dev
88

9-
```bash
10-
./scripts/get_pub_credentials.sh
11-
```
12-
13-
If not logged in yet: `flutter pub login`
14-
15-
### 2. Add to GitHub Secrets
9+
1. Go to [pub.dev](https://pub.dev) and sign in
10+
2. Navigate to your package page
11+
3. Go to the **Admin** tab
12+
4. Under **Automated Publishing**, click **Enable publishing from GitHub Actions**
13+
5. Enter your repository: `<your-github-username>/<your-repository-name>`
14+
6. Set tag pattern: `v{{version}}`
1615

17-
1. Go to Settings → Secrets and variables → Actions
18-
2. Add new secret: `PUB_CREDENTIALS`
19-
3. Paste the JSON content from step 1
16+
**Note:** You must be a verified publisher or have uploader permissions on the package.
2017

2118
## Release Process
2219

@@ -50,32 +47,60 @@ version: 0.2.0 # Update accordingly
5047
- Renamed method `oldName()` to `newName()`
5148
```
5249
53-
### 3. Commit and push
50+
### 3. Run validation checks
51+
52+
Before committing, ensure all checks pass locally:
53+
54+
```bash
55+
./scripts/run_checks.sh
56+
```
57+
58+
This script runs the same checks as CI:
59+
60+
- Code formatting
61+
- Static analysis
62+
- Unit tests
63+
- pub.dev score check
64+
- Package validation
65+
66+
### 4. Commit and push
5467

5568
```bash
5669
git add pubspec.yaml CHANGELOG.md
5770
git commit -m "chore: bump version to 0.2.0"
5871
git push origin main
5972
```
6073

61-
### 4. Create GitHub Release
74+
### 5. Create and push tag
6275

63-
1. Go to Releases → Create a new release
64-
2. Create tag: `v0.2.0` (with 'v' prefix)
65-
3. Title: `v0.2.0`
66-
4. Copy notes from CHANGELOG.md
67-
5. Publish release
76+
```bash
77+
# Create tag matching the version
78+
git tag v0.2.0
6879

69-
The GitHub Action will automatically publish to pub.dev.
80+
# Push the tag to trigger publishing
81+
git push origin v0.2.0
82+
```
83+
84+
The GitHub Action will automatically publish to pub.dev using OIDC authentication.
7085

71-
### 5. Monitor
86+
### 6. Monitor
7287

7388
Check the Actions tab for the "Publish to pub.dev" workflow status.
7489

90+
### 7. Create GitHub Release (Optional)
91+
92+
After successful publishing, you can create a GitHub release:
93+
94+
1. Go to Releases → Create a new release
95+
2. Choose existing tag: `v0.2.0`
96+
3. Title: `v0.2.0`
97+
4. Copy notes from CHANGELOG.md
98+
5. Publish release
99+
75100
## Troubleshooting
76101

77-
- **Tests failing**: Fix and create new release
78-
- **Credentials issue**: Verify `PUB_CREDENTIALS` secret
102+
- **Workflow not triggering**: Ensure tag matches pattern `v{{version}}`
103+
- **Authentication failed**: Verify automated publishing is enabled on pub.dev
79104
- **Version conflict**: Ensure version bump in pubspec.yaml
80105
- **Manual fallback**: `flutter pub publish`
81106

pubspec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ dependencies:
1919

2020
# Mobile-specific dependencies
2121
daily_flutter: ^0.31.0
22+
# Note: permission_handler is constrained by daily_flutter 0.31.0
23+
# which requires ^11.3.1. Update when daily_flutter supports ^12.0.0
2224
permission_handler: ^11.3.1
2325

2426
# Web-specific dependencies

0 commit comments

Comments
 (0)