Builds
When you create a new commit in Git, a new version of your code is created. With Widgetbook builds developers make the new version of their local Widgetbook accessible for the whole team. If set up with CI/CD, you can have a build for each commit, for each pull-request and for each branch.
Build process#
Widgetbook Cloud builds have to be uploaded based on a Flutter web build. To create a Flutter web build, follow these steps:
- Locate your Widgetbook project
- Run the build runner by using
flutter pub run build_runner build -d
- Run
flutter build web -t widgetbook.dart
Publish a build#
A Flutter web build of Widgetbook is published by using the Widgetbook CLI. An API key is required to publish a build. See How to Create an API Key for more information.
To publish a build, follow these steps:
- Activate the CLI by running
pub global activate widgetbook_cli
- Run
widgetbook publish --api-key API-KEY
Feel free to customize the publish
command by reading into the CLI arguments.
Publishing builds with the CI/CD is recommended as the setup is less error prone and more autonomous. See CI/CD Setup for more information.
Example#
# Install dependencies
flutter pub get
# Optional: Run the build runner
flutter pub run build_runner build --delete-conflicting-outputs
# Build the Widgetbook
flutter build web -t lib/ui_catalogs.widgetbook.dart
# Install the CLI
dart pub global activate widgetbook_cli
# Run the CLI
widgetbook publish --api-key API-KEY