Flutter Somnio Starter made with Mason.
mason add -g somnio_starter_template --git-url https://github.com/somnio-software/somnio-starter --git-ref=templates --git-path somnio_starter_templateThis repo uses two branches:
main— Source of truth. It contains the example app (somnio_starter_example/) and the generator (tool/generator/). All edits to the template content happen here.templates— Holds the generated Mason brick that users install with the command above. This branch is updated automatically by a GitHub Actions workflow; you do not edit it by hand.
When you push changes to main that touch the example or the generator, a workflow runs, regenerates the brick, and opens a pull request. Merging that PR updates the templates branch so new and existing users get the latest template.
flowchart LR
main[main branch]
workflow[generate_somnio_starter_template]
pr[PR to chore/generate branch]
templates[templates branch]
main --> workflow
workflow --> pr
pr -->|"squash and merge"| templates
What triggers an update
The workflow generate_somnio_starter_template runs when:
- There is a push to
mainthat changes files undertool/generator/**orsomnio_starter_example/**, or - You run it manually from the Actions tab (workflow_dispatch).
What the workflow does
- Runs the Dart generator (
dart tool/generator/main.dart), which copies the example app and repo.githubinto the brick and replaces fixed names with template variables. - Checks out the
templatesbranch and replaces the currentsomnio_starter_template/__brick__/content with the new output. - Opens a pull request from branch
chore/generate-somnio-starter-templatewith the commit message "chore: generate somnio_starter_template".
What you need to do
- Review the opened PR (from
chore/generate-somnio-starter-templateintotemplates). - Squash and merge the PR. That updates the
templatesbranch, so the published template (used when people runmason add ... --git-ref=templates) is up to date.
To regenerate without pushing to main, go to Actions → generate_somnio_starter_template → Run workflow.
If you already created a project with this brick and want to pull in the latest template changes:
-
Update the brick so Mason has the latest version:
- Run
mason getif the brick is already in your global config, or - Add it again with the same options:
mason add -g somnio_starter_template --git-url https://github.com/somnio-software/somnio-starter --git-ref=templates --git-path somnio_starter_template
- Run
-
Re-run generation in your project directory with the same variables you used initially (e.g.
project_name,flutter_version,app_name,reverse_domain, etc.). Use--on-conflictto control overwrites:overwrite— replace existing files with the template version.skip— keep your existing file.prompt— ask for each conflict (default).
Example (adjust variables to match your project):
mason make somnio_starter_template --project-name my_app --flutter-version "3.41.2" --on-conflict overwrite -
Review changes, especially under
.github/workflows/. The template may add or change workflow files; the main CI workflow is named after your project (e.g.my_app.yaml) and uses paths relative to the repo root.
Generated projects include workflows under .github/workflows/ that come from the template. These typically include:
- A main CI workflow named after your project (e.g.
my_app.yaml) that runs on pull requests whenlib/**,test/**,packages/**, orpubspec.yamlchange. - Other workflows as defined in the template (e.g. token_provider, api_client, auth_client, app_ui, form_inputs, user_repository, spell_checker).
Workflows are parameterized with your project name and use paths relative to the repository root (no working_directory). When you update your project from the template, new or changed workflow files may appear; review and merge them so your CI stays in sync with the template.