A collection of reusable GitHub Actions workflows for Dart and Flutter projects. These workflows are designed to streamline CI/CD processes, enforce code quality standards, and automate publishing to pub.dev.
File: .github/workflows/ci.yml
A comprehensive continuous integration workflow for Dart/Flutter projects using Melos for monorepo management.
- β Multi-package testing with Melos
- π Static code analysis with Dart Analyzer
- π― Optional DCM (Dart Code Metrics) integration
- π Customizable Melos commands
- β‘ Concurrent execution with auto-cancellation
- π¦ FVM (Flutter Version Management) support
name: CI
on:
pull_request:
push:
branches: [main]
jobs:
ci:
uses: conceptadev/dart-actions/.github/workflows/ci.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
with:
flutter-version: "stable"
run-dcm: true
melos-commands: |
melos run format:check
melos run build_runner| Input | Description | Required | Default |
|---|---|---|---|
flutter-version |
Flutter version to use (e.g., "stable", "3.19.0") | No | "stable" |
run-dcm |
Whether to run DCM analysis | No | true |
melos-commands |
Custom Melos commands to run (one per line) | No | "" |
| Secret | Description | Required |
|---|---|---|
token |
GitHub token for authentication (used for DCM) | Yes |
- Checkout - Clones your repository
- Setup Flutter - Installs specified Flutter version using FVM
- Setup Melos - Installs and configures Melos
- Bootstrap - Runs
melos bootstrapto install dependencies - Custom Commands - Executes any custom Melos commands you specify
- Analysis - Runs Dart analyzer on all packages
- DCM - Runs Dart Code Metrics (if enabled)
- Testing - Runs all Flutter and Dart tests
File: .github/workflows/pr-title-check.yml
Validates pull request titles against Conventional Commits specification.
- π Enforces Conventional Commits format
- π¬ Automatic PR comments with helpful error messages
- π Auto-removes comments when title is fixed
- π¨ Customizable messages
name: PR Title Check
on:
pull_request:
types: [opened, edited, synchronize, reopened]
jobs:
pr-title-check:
uses: conceptadev/dart-actions/.github/workflows/pr-title-check.yml@mainjobs:
pr-title-check:
uses: conceptadev/dart-actions/.github/workflows/pr-title-check.yml@main
with:
comment_header: "custom-pr-title-lint"
comment_message: |
β οΈ Your PR title doesn't follow our guidelines!
Please use: `type(scope): description`
Examples:
- feat(auth): add login functionality
- fix(ui): resolve button alignment issue
- docs: update README| Input | Description | Required | Default |
|---|---|---|---|
comment_header |
Header used for the sticky PR comment | No | "pr-title-lint-error" |
comment_message |
Custom message shown when PR title is invalid | No | Default error message |
feat: add new feature
fix: resolve critical bug
docs: update documentation
style: format code
refactor: restructure component
test: add missing tests
chore: update dependencies
feat(auth)!: breaking change in authentication
File: .github/workflows/publish.yml
Automates publishing of Dart/Flutter packages to pub.dev using OIDC authentication.
- π Automated publishing to pub.dev
- π Secure OIDC authentication (no API tokens needed)
- π¦ Multi-package support with parallel execution
- β Pre-publish validation (analyze, test, dry-run)
- π― Fail-safe mode (continues on individual package failures)
name: Publish Packages
on:
release:
types: [published]
jobs:
publish:
uses: conceptadev/dart-actions/.github/workflows/publish.yml@main
with:
packages_folder_path: "packages"
packages: |
my_package
another_package
third_package| Input | Description | Required | Example |
|---|---|---|---|
packages_folder_path |
Path to the folder containing packages | Yes | "packages" |
packages |
List of package names to publish (one per line) | Yes | See example above |
flutter_version_file |
Repository-relative path to an exact Flutter version in .fvmrc, .fvm/fvm_config.json, or pubspec.yaml |
No | ".fvmrc" |
Set flutter_version_file: ".fvmrc" to publish with the same SDK pinned by
your project. When omitted, the workflow continues to use the latest stable
Flutter release. A pubspec.yaml version file must declare an exact Flutter
version, not a range.
Dependency installation, tests, and the publication dry run use public access. The workflow provisions OIDC credentials only immediately before upload, with the Dart SDK version bundled in the selected Flutter release.
For each package:
- Checkout - Clones the repository
- Setup - Installs Dart and Flutter
- Dependencies - Runs
flutter pub get - Analysis - Runs
flutter analyze - Testing - Runs
flutter test - Dry Run - Tests publishing with
dart pub publish --dry-run - Publish - Publishes to pub.dev using OIDC authentication
- Your repository must be set up for OIDC publishing
- The workflow requires
id-token: writepermission (already configured) - A "Production" environment should be configured in your repository settings
Create a .github/workflows directory in your repository and add your workflow files:
# .github/workflows/ci.yml
name: CI
on:
pull_request:
push:
branches: [main]
jobs:
ci:
uses: conceptadev/dart-actions/.github/workflows/ci.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}# .github/workflows/pr-check.yml
name: PR Checks
on:
pull_request:
types: [opened, edited, synchronize, reopened]
jobs:
title-check:
uses: conceptadev/dart-actions/.github/workflows/pr-title-check.yml@main# .github/workflows/publish.yml
name: Publish
on:
workflow_dispatch:
inputs:
packages:
description: 'Package names (comma-separated)'
required: true
jobs:
publish:
uses: conceptadev/dart-actions/.github/workflows/publish.yml@main
with:
packages_folder_path: "packages"
packages: ${{ inputs.packages }}Ensure your workflows have the necessary permissions:
permissions:
contents: read # For checkout
pull-requests: write # For PR comments
id-token: write # For OIDC publishingFor publishing to pub.dev:
- Enable OIDC publishing in your pub.dev account
- Configure a "Production" environment in your repository settings
- Ensure your packages have proper version numbers and changelogs
jobs:
ci:
uses: conceptadev/dart-actions/.github/workflows/ci.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}jobs:
ci:
uses: conceptadev/dart-actions/.github/workflows/ci.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
with:
flutter-version: "3.19.0"jobs:
ci:
uses: conceptadev/dart-actions/.github/workflows/ci.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
with:
melos-commands: |
melos run build_runner
melos run format:checkjobs:
ci:
uses: conceptadev/dart-actions/.github/workflows/ci.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
with:
run-dcm: falsename: Publish Packages
on:
workflow_dispatch:
inputs:
packages:
description: 'Package names to publish'
required: true
type: string
jobs:
publish:
uses: conceptadev/dart-actions/.github/workflows/publish.yml@main
with:
packages_folder_path: "packages"
packages: ${{ inputs.packages }}name: Publish on Release
on:
release:
types: [published]
jobs:
publish:
uses: conceptadev/dart-actions/.github/workflows/publish.yml@main
with:
packages_folder_path: "packages"
packages: |
core_package
utils_package
ui_package- Coverage Comment Action - Automated code coverage analysis and PR comments
- Conventional Commits - Commit message specification
- Melos - Tool for managing Dart/Flutter monorepos
- OIDC Publishing - Secure package publishing
When contributing to these workflows:
- Ensure PR titles follow Conventional Commits
- Test workflow changes thoroughly
- Update documentation for any new features
- Maintain backward compatibility when possible
See LICENSE file for details.