Skip to content

added new publishing steps #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 85 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,102 @@ name: CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
flutter_path: /opt/hostedtoolcache/flutter
- os: macos-latest
flutter_path: /Users/runner/hostedtoolcache/flutter
- os: windows-latest
flutter_path: C:\hostedtoolcache\windows\flutter

steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.27.0'
channel: 'stable'

- name: Install dependencies
run: flutter pub get

- name: Analyze code

- name: Verify formatting
run: dart format --output=none --set-exit-if-changed .

- name: Analyze project source
run: flutter analyze

# - name: Run tests
# run: flutter test

- name: Check formatting
run: dart format --set-exit-if-changed .

- name: Check publish readiness

- name: Run tests
run: flutter test

- name: Check pub score
run: |
dart pub global activate pana
echo "Running pana analysis..."
dart pub global run pana --no-warning --exit-code-threshold 10
echo ""
echo "Note: permission_handler is constrained to ^11.3.1 by daily_flutter 0.31.0"
echo "This causes a 10-point deduction in the pub score."

example:
name: Build example app
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.27.0'
channel: 'stable'

- name: Install dependencies (root)
run: flutter pub get

- name: Install dependencies (example)
run: |
cd example
flutter pub get

- name: Build Android APK
run: |
cd example
flutter build apk --debug

- name: Build iOS (simulator only)
if: matrix.os == 'macos-latest'
run: |
cd example
flutter build ios --debug --simulator

publish-dry-run:
name: Publish dry run
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.27.0'
channel: 'stable'

- name: Install dependencies
run: flutter pub get

- name: Publish dry run
run: flutter pub publish --dry-run
56 changes: 6 additions & 50 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,12 @@
name: Publish to pub.dev

on:
release:
types: [published]
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.27.0'
channel: 'stable'

- name: Verify version consistency
run: |
# Extract version from pubspec.yaml
PUBSPEC_VERSION=$(grep '^version: ' pubspec.yaml | sed 's/version: //')
# Remove 'v' prefix from tag if present
TAG_VERSION=${GITHUB_REF_NAME#v}

echo "Tag version: $TAG_VERSION"
echo "Pubspec version: $PUBSPEC_VERSION"

if [ "$TAG_VERSION" != "$PUBSPEC_VERSION" ]; then
echo "Error: Tag version ($TAG_VERSION) does not match pubspec.yaml version ($PUBSPEC_VERSION)"
echo "Please ensure your tag matches the version in pubspec.yaml"
exit 1
fi

echo "✓ Version check passed!"

- name: Install dependencies
run: flutter pub get

- name: Setup Dart credentials
run: |
mkdir -p ~/.pub-cache
echo '${{ secrets.PUB_CREDENTIALS }}' > ~/.pub-cache/credentials.json

- name: Verify package scores
run: |
echo "Running package verification..."
flutter pub publish --dry-run

- name: Publish to pub.dev
run: |
# Using --force because this runs in CI without user interaction
# The dry-run above ensures the package is valid before publishing
flutter pub publish --force
permissions:
id-token: write # Required for authentication using OIDC
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Vapi Flutter SDK

[![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)
[![pub package](https://img.shields.io/pub/v/vapi.svg)](https://pub.dev/packages/vapi)

## Minimum requirements

### Mobile
Expand Down
69 changes: 47 additions & 22 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ This guide explains how to release new versions of the Vapi Flutter SDK to pub.d

## Initial Setup (One-time)

### 1. Get pub.dev credentials
### Enable Automated Publishing on pub.dev

```bash
./scripts/get_pub_credentials.sh
```

If not logged in yet: `flutter pub login`

### 2. Add to GitHub Secrets
1. Go to [pub.dev](https://pub.dev) and sign in
2. Navigate to your package page
3. Go to the **Admin** tab
4. Under **Automated Publishing**, click **Enable publishing from GitHub Actions**
5. Enter your repository: `<your-github-username>/<your-repository-name>`
6. Set tag pattern: `v{{version}}`

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

## Release Process

Expand Down Expand Up @@ -50,32 +47,60 @@ version: 0.2.0 # Update accordingly
- Renamed method `oldName()` to `newName()`
```

### 3. Commit and push
### 3. Run validation checks

Before committing, ensure all checks pass locally:

```bash
./scripts/run_checks.sh
```

This script runs the same checks as CI:

- Code formatting
- Static analysis
- Unit tests
- pub.dev score check
- Package validation

### 4. Commit and push

```bash
git add pubspec.yaml CHANGELOG.md
git commit -m "chore: bump version to 0.2.0"
git push origin main
```

### 4. Create GitHub Release
### 5. Create and push tag

1. Go to Releases → Create a new release
2. Create tag: `v0.2.0` (with 'v' prefix)
3. Title: `v0.2.0`
4. Copy notes from CHANGELOG.md
5. Publish release
```bash
# Create tag matching the version
git tag v0.2.0

The GitHub Action will automatically publish to pub.dev.
# Push the tag to trigger publishing
git push origin v0.2.0
```

The GitHub Action will automatically publish to pub.dev using OIDC authentication.

### 5. Monitor
### 6. Monitor

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

### 7. Create GitHub Release (Optional)

After successful publishing, you can create a GitHub release:

1. Go to Releases → Create a new release
2. Choose existing tag: `v0.2.0`
3. Title: `v0.2.0`
4. Copy notes from CHANGELOG.md
5. Publish release

## Troubleshooting

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

Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ dependencies:

# Mobile-specific dependencies
daily_flutter: ^0.31.0
# Note: permission_handler is constrained by daily_flutter 0.31.0
# which requires ^11.3.1. Update when daily_flutter supports ^12.0.0
permission_handler: ^11.3.1

# Web-specific dependencies
Expand Down
Loading