Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

[tool] add an skip-confirmation flag to publish-package for running the command on ci #3842

Merged
merged 8 commits into from
May 11, 2021

Conversation

cyanglaz
Copy link
Contributor

@cyanglaz cyanglaz commented May 3, 2021

the skip-confirmation flag will add a --force flag to pub publish, it will also let users to skip the y/n question when pushing tags to remote.

Fixes flutter/flutter#79830

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides. (Note that unlike the flutter/flutter repo, the flutter/plugins repo does use dart format. See plugin_tool format)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@cyanglaz cyanglaz requested a review from stuartmorgan May 3, 2021 23:52
@google-cla google-cla bot added the cla: yes label May 3, 2021
@@ -84,6 +84,14 @@ class PublishPluginCommand extends PluginCommand {
defaultsTo: false,
negatable: true,
);
argParser.addFlag(_yesOption,
help: 'Running the command without asking for Y/N inputs.\n'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Running/Run/

help: 'Running the command without asking for Y/N inputs.\n'
'This command will add a `--force` flag to the `pub publish` command if it is not added with $_pubFlagsOption\n'
'It also skips the y/n inputs when pushing tags to remote.\n'
'If running this on CI, an environment variable named $_pubCredentialName must be set to a String that represents the pub credential JSON.\n'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and the next line) isn't really about this flag in particular, is it?

@@ -93,6 +101,9 @@ class PublishPluginCommand extends PluginCommand {
static const String _remoteOption = 'remote';
static const String _allChangedFlag = 'all-changed';
static const String _dryRunFlag = 'dry-run';
static const String _yesOption = 'yes';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about --skip-confirmation since that makes it self-documenting where it's used?

(Also because no-skip-confirmation makes a lot more sense for the negated version than no-yes.)

Copy link
Contributor Author

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartmorgan Updated per comments! PTAL

@cyanglaz cyanglaz changed the title [tool] add an yes flag to publish-package for running the command on ci [tool] add an skip-confirmation flag to publish-package for running the command on ci May 4, 2021
@cyanglaz cyanglaz requested a review from stuartmorgan May 4, 2021 20:55
Copy link
Contributor

@stuartmorgan stuartmorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nits.

fileSystem.file(credentialPath)
..createSync(recursive: true)
..writeAsStringSync('some credential');
}

setUp(() async {
// This test uses a local file system instead of an in memory one throughout
// so that git actually works. In setup we initialize a mono repo of plugins
// with one package and commit everything to Git.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move the local filesystem part of this comment up to line 32.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -49,8 +56,7 @@ void main() {
processRunner = TestProcessRunner();
mockStdin = MockStdin();
commandRunner = CommandRunner<void>('tester', '')
..addCommand(PublishPluginCommand(
mockPackagesDir, mockPackagesDir.fileSystem,
..addCommand(PublishPluginCommand(mockPackagesDir, fileSystem,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to move away from mockPackagesDir, since it's weirdly indirect. parentDir is the same directory, but much more clear based on local context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@cyanglaz cyanglaz merged commit e674e0d into flutter:master May 11, 2021
@cyanglaz cyanglaz deleted the auto-publish-flag branch May 11, 2021 21:40
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 11, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 11, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 12, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 12, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 12, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 19, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 19, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 19, 2021
fotiDim pushed a commit to fotiDim/plugins that referenced this pull request Sep 13, 2021
… the command on ci (flutter#3842)

the skip-confirmation flag will add a --force flag to pub publish, it will also let users to skip the y/n question when pushing tags to remote.

Fixes flutter/flutter#79830
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

publish-plugin is able to automatically publish plugins based on pubspec changes
2 participants