Skip to content

Commit 5bc6ca1

Browse files
authored
Document publishing process. (#945)
1 parent f27c632 commit 5bc6ca1

1 file changed

Lines changed: 46 additions & 8 deletions

File tree

docs/contributing/publishing.md

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Packages in this repo fall into the following categories:
2929

3030
1. Tells Dart to share dependency resolution and a lockfile with the monorepo.
3131

32-
2. Tells to use current repo as a source for the package, not pub.dev (for local runs).
32+
2. Tells to use **current repo as a source** for the package, not pub.dev (for local runs).
3333

3434
Note that a package can opt out (by omitting `resolution: workspace`) to have separate dependency resolution.
3535

@@ -41,11 +41,13 @@ The packages code should be always release ready. That means:
4141

4242
1.1. The package is planned to be released in the future. In this case it is published with `-wip` suffix in order to reserve the package name.
4343

44-
1.2. The package's changes touch only non-publishable code or docs (like tests, tools, or not-publishable docs).
44+
1.2. The package's last changes touch only non-publishable code or docs (like tests, tools, or not-publishable docs).
4545

4646
You can publish `-wip<number>` versions (where `<number>` is a three-digit, zero padded integer like `-wip003`), if you need it for development.
4747

48-
2. If your feature is partially implemented, hide the feature's code behind a false-by-default flag, and use **release-ready** version. (There is no detailed guidance how to define this flag yet. It should be outlined when it is needed. Please create an issue if you need it soon.)
48+
2. Remove `-wip` suffix from a version in `pubspec.yaml`, if your change in this package is publishable.
49+
50+
3. If your feature is partially implemented, hide the feature's code behind a false-by-default flag, and use **release-ready** version. (There is no detailed guidance how to define this flag yet. It should be outlined when it is needed. Please create an issue if you need it soon.)
4951

5052
## Versioning
5153

@@ -60,19 +62,25 @@ major number for breaking changes.
6062

6163
## How publishing happens?
6264

63-
TODO(polina-c): add information, https://github.com/google/A2UI/issues/1383
65+
1. **Auto**: The workflow job `publish / validate` will:
66+
- check if the PR follows [firehose rules](https://github.com/dart-lang/ecosystem/tree/main/pkgs/firehose).
67+
- add a table [like this](https://github.com/flutter/genui/pull/941#issuecomment-4556675732) to each PR.
68+
69+
2. **Manual**: After reviewing and merging the PR, for each 'ready to publish' version the author of the PR should run `flutter pub publish` or `dart pub publish`.
6470

65-
## How upgrade of dependencies (for both siblings and third party) happens?
71+
TODO(polinach): update this section after fix of https://github.com/dart-lang/ecosystem/issues/418.
6672

67-
### For local development runs
73+
## How upgrade of dependencies happens?
74+
75+
### For run in workspace
6876

6977
For packages with `resolution: workspace` in their pubspec.yaml, pub resolves every sibling from its local source directory — not from pub.dev, as long as its `version:` satisfies the consumer's constraint.
7078

7179
If a local bump escapes that constraint (e.g. `^0.9.0``0.10.0`), you must update the consumer's `pubspec.yaml` in the same PR. While `dart pub` natively silently falls back to the published version on pub.dev, **our `test_and_fix` CI suite contains a verification step that will explicitly throw an error** and fail your PR if internal workspace version constraints are not met.
7280

73-
### For runs by external packages
81+
### For global dependencies
7482

75-
After a new version of a dependency (including sibling package in this repo) is published, this is how upgrade will happen:
83+
After a new version of a dependency is published, this is how upgrade will happen:
7684

7785
1. [Dependabot] detects the new version on pub.dev and opens a PR per dependency, bumping the constraint in each consuming `pubspec.yaml`. See [About Dependabot version updates] for details.
7886
2. The PR runs `publish / validate` and the rest of CI.
@@ -83,3 +91,33 @@ TODO: Consume solution for [dependabot issue][dependabot/dependabot-core#15057]
8391
[Dependabot]: ../../.github/dependabot.yaml
8492
[About Dependabot version updates]: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/about-dependabot-version-updates
8593
[dependabot/dependabot-core#15057]: https://github.com/dependabot/dependabot-core/issues/15057
94+
95+
## How to configure GitHub and pub.dev for auto-publishing?
96+
97+
GitHub and pub.dev are already configured for auto-publishing. This section is here in case this needs to be reproduced for new repo or new package.
98+
99+
Note that you need to have administrative permissions to update configuration.
100+
101+
### Setup org permissions
102+
103+
In https://github.com/organizations/flutter/settings/actions:
104+
105+
1. Find the section "Allow or block specified actions and reusable workflows"
106+
2. Add these values (if they are already here, they will be de-dupped automatically):
107+
108+
```
109+
peter-evans/create-or-update-comment@*,
110+
peter-evans/create-pull-request@*,
111+
peter-evans/repository-dispatch@*,
112+
dart-lang/ecosystem/.github/workflows/publish.yaml@*,
113+
dart-lang/ecosystem/.github/workflows/post_summaries.yaml@*,
114+
```
115+
116+
### Configure pub.dev for each package
117+
118+
This requires uploader/admin rights on the package.
119+
120+
1. Go to https://pub.dev/packages/<YOUR_PACKAGE_NAME>/admin
121+
2. Under "Automated publishing", enable "Publishing from GitHub Actions" for both `push` and `workflow_dispatch` events.
122+
3. Set Repository to `<YOUR_ORG>/<YOUR_REPO>`.
123+
4. Set Tag pattern to `<YOUR_PACKAGE_NAME>-v{{version}}`.

0 commit comments

Comments
 (0)