How to create a company#
- Select the Company tab in the navigation rail of the app.
- Click the Add company button.
- Fill out the form.
How to create a project#
- Select the Projects tab in the navigation rail of the app.
- Click the Create project button.
- Fill out the form.
How to create an API Key#
- Log in to Widgetbook Cloud with your account.
- API keys are tied to projects, so you need a project to obtain an API key.
- Only users with the
Ownerrole can fetch a project's API key to protect sensitive information.
- If you are not a project owner but need the API key, ask your project owner to promote you from member to owner. For more information on member management, see Member Management.
- To create a new project, create a company first.
- On the project's detail page, a card with a button to fetch the API key is displayed. Click the button to copy the API key to your clipboard.
How to add workflows for CI/CD#
For Widgetbook Cloud to work properly we recommend to create workflows for two different events:
- When a new commit is published to the base branch (
stagingor whatever branch you like)
- When a new pull request is opened and whenever the Git history changes for the pull-request
Due to specifics of each CI/CD vendor, we prepared the following examples for you:
Not finding your vendor? Let us know via Discord. We are happy to assist you.
1. New commit workflow#
A general workflow for uploading a new version of your Widgetbook to Widgetbook Cloud looks like this:
# Install dependencies flutter pub get # Run the build runner (Optional) 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 # Execute the CLI widgetbook publish --api-key API-KEY
2. Pull request workflow#
Whenever a pull-request is created or updated, Widgetbook Cloud requires information on what changed.
Therefore, the CLI requires the
--base-branch agrument to compare the current feature branch against the base branch.
For this to fully work, the CLI also requires the
Therefore, make sure that
build_runner runs before the CLI even if you have committed all generated files.
# Install dependencies flutter pub get # !!! # !!! Run the build runner # !!! This is mandatory even if you have commited the generated files since # !!! the generator creates files that are consumed by the Widgetbook CLI # !!! 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 --base-branch main
Workflow for the first review#
- Create a new commit on your base branch containing a Widgetbook with at least one use case
- Push the commit to your remote repository
- Check if the workflow for new commits is triggered and succeeds
- Check if you see a new Widgetbook Cloud build for the branch you pushed to
- Make adjustments to one or multiple use cases
- Create a new feature branch
- Commit your changes
- Push the commit and the new feature branch to your remote repository
- Check if the workflow for new pull-requests is triggered and succeeds
- Check if you see a new Widgetbook Cloud build for the new feature branch you pushed to
- Check if you see a new open Widgetbook Cloud review