|
3 | 3 | // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
|
5 | 5 | import 'package:_pub_shared/data/package_api.dart'; |
| 6 | +import 'package:pub_dev/frontend/request_context.dart'; |
6 | 7 |
|
7 | 8 | import '../../../../account/models.dart'; |
8 | 9 | import '../../../../package/models.dart'; |
@@ -32,17 +33,27 @@ d.Node packageAdminPageNode({ |
32 | 33 | ], |
33 | 34 | ), |
34 | 35 | TocNode( |
35 | | - 'Automated publishing', |
36 | | - href: '#automated-publishing', |
| 36 | + 'Publishing', |
| 37 | + href: '#publishing', |
37 | 38 | children: [ |
38 | | - TocNode('GitHub Actions', href: '#github-actions'), |
| 39 | + if (requestContext |
| 40 | + .experimentalFlags |
| 41 | + .isManualPublishingConfigAvailable) |
| 42 | + TocNode('Manual publishing', href: '#manual-publishing'), |
39 | 43 | TocNode( |
40 | | - 'Google Cloud Service account', |
41 | | - href: '#google-cloud-service-account', |
| 44 | + 'Automated publishing', |
| 45 | + href: '#automated-publishing', |
| 46 | + children: [ |
| 47 | + TocNode('GitHub Actions', href: '#github-actions'), |
| 48 | + TocNode( |
| 49 | + 'Google Cloud Service account', |
| 50 | + href: '#google-cloud-service-account', |
| 51 | + ), |
| 52 | + ], |
42 | 53 | ), |
| 54 | + TocNode('Version retraction', href: '#version-retraction'), |
43 | 55 | ], |
44 | 56 | ), |
45 | | - TocNode('Version retraction', href: '#version-retraction'), |
46 | 57 | ]), |
47 | 58 | d.a(name: 'ownership'), |
48 | 59 | d.h2(text: 'Package ownership'), |
@@ -226,6 +237,10 @@ d.Node packageAdminPageNode({ |
226 | 237 | ), |
227 | 238 | ), |
228 | 239 | ], |
| 240 | + d.a(name: 'publishing'), |
| 241 | + d.h2(text: 'Publishing'), |
| 242 | + if (requestContext.experimentalFlags.isManualPublishingConfigAvailable) |
| 243 | + _manualPublishing(package), |
229 | 244 | _automatedPublishing(package), |
230 | 245 | d.a(name: 'version-retraction'), |
231 | 246 | d.h2(text: 'Version retraction'), |
@@ -304,7 +319,7 @@ d.Node _automatedPublishing(Package package) { |
304 | 319 | final isGitHubEnabled = github?.isEnabled ?? false; |
305 | 320 | return d.fragment([ |
306 | 321 | d.a(name: 'automated-publishing'), |
307 | | - d.h2(text: 'Automated publishing'), |
| 322 | + d.h3(text: 'Automated publishing'), |
308 | 323 | d.markdown( |
309 | 324 | 'You can automate publishing from the supported automated deployment environments. ' |
310 | 325 | 'Instead of creating long-lived secrets, you may use temporary OpenID-Connect tokens ' |
@@ -453,6 +468,28 @@ d.Node _automatedPublishing(Package package) { |
453 | 468 | ]); |
454 | 469 | } |
455 | 470 |
|
| 471 | +d.Node _manualPublishing(Package package) { |
| 472 | + final manual = package.automatedPublishing?.manualConfig; |
| 473 | + return d.fragment([ |
| 474 | + d.a(name: 'manual-publishing'), |
| 475 | + d.h3(text: 'Manual publishing'), |
| 476 | + d.markdown(''' |
| 477 | +Manual publishing, using personal credentials for the `pub` client (`pub login`) . |
| 478 | +
|
| 479 | +Disable to prevent accidental publication from the command line. |
| 480 | +
|
| 481 | +It is recommended to disable when automated publishing is enabled.'''), |
| 482 | + d.div( |
| 483 | + classes: ['-pub-form-checkbox-row'], |
| 484 | + child: material.checkbox( |
| 485 | + id: '-pkg-admin-manual-publishing-enabled', |
| 486 | + label: 'Enable manual publishing', |
| 487 | + checked: manual?.isEnabled ?? true, |
| 488 | + ), |
| 489 | + ), |
| 490 | + ]); |
| 491 | +} |
| 492 | + |
456 | 493 | d.Node _exampleGitHubWorkflow(GitHubPublishingConfig github) { |
457 | 494 | final expandedTagPattern = (github.tagPattern ?? '{{version}}').replaceAll( |
458 | 495 | '{{version}}', |
|
0 commit comments