diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index dc036362..fcec958d 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -94,7 +94,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ISSUE_NUMBER: ${{ github.event.number }} PR_LABELS: "${{ join(github.event.pull_request.labels.*.name) }}" - run: dart pub global run firehose --validate --use-flutter ${{ inputs.use-flutter }} + run: dart pub global run firehose --validate ${{ inputs.use-flutter && '--use-flutter' || '--no-use-flutter' }} publish: if: ${{ github.event_name == 'push' }} @@ -124,4 +124,4 @@ jobs: run: dart pub global activate firehose - name: Publish packages - run: dart pub global run firehose --publish --use-flutter ${{ inputs.use-flutter }} + run: dart pub global run firehose --publish ${{ inputs.use-flutter && '--use-flutter' || '--no-use-flutter' }} diff --git a/pkgs/firehose/CHANGELOG.md b/pkgs/firehose/CHANGELOG.md index db78347a..6ebed0d1 100644 --- a/pkgs/firehose/CHANGELOG.md +++ b/pkgs/firehose/CHANGELOG.md @@ -1,9 +1,11 @@ ## 0.3.27 - Fix Flutter support. + ## 0.3.26 - Add support for Flutter package auto-publishing, fixing [#154](https://github.com/dart-lang/ecosystem/issues/154). + ## 0.3.25 - Switch to pub.dev API in `package:firehose`. diff --git a/pkgs/firehose/bin/firehose.dart b/pkgs/firehose/bin/firehose.dart index 645c8b6c..089648cd 100644 --- a/pkgs/firehose/bin/firehose.dart +++ b/pkgs/firehose/bin/firehose.dart @@ -8,23 +8,24 @@ import 'package:args/args.dart'; import 'package:firehose/firehose.dart'; import 'package:firehose/src/github.dart'; -const validateOption = 'validate'; -const publishOption = 'publish'; -const useFlutterOption = 'use-flutter'; +const helpFlag = 'help'; +const validateFlag = 'validate'; +const publishFlag = 'publish'; +const useFlutterFlag = 'use-flutter'; void main(List arguments) async { var argParser = _createArgs(); try { - var argResults = argParser.parse(arguments); + final argResults = argParser.parse(arguments); - if (argResults['help'] == true) { + if (argResults[helpFlag] as bool) { _usage(argParser); exit(0); } - var validate = argResults[validateOption] == true; - var publish = argResults[publishOption] == true; - var useFlutter = argResults[useFlutterOption] == true; + final validate = argResults[validateFlag] as bool; + final publish = argResults[publishFlag] as bool; + final useFlutter = argResults[useFlutterFlag] as bool; if (!validate && !publish) { _usage(argParser, @@ -32,7 +33,7 @@ void main(List arguments) async { exit(1); } - var github = Github(); + final github = Github(); if (publish && !github.inGithubContext) { _usage(argParser, error: 'Error: --publish can only be executed from within a GitHub ' @@ -40,7 +41,7 @@ void main(List arguments) async { exit(1); } - var firehose = Firehose(Directory.current, useFlutter); + final firehose = Firehose(Directory.current, useFlutter); if (validate) { await firehose.validate(); @@ -67,24 +68,24 @@ void _usage(ArgParser argParser, {String? error}) { ArgParser _createArgs() { return ArgParser() ..addFlag( - 'help', + helpFlag, abbr: 'h', negatable: false, help: 'Print tool help.', ) ..addFlag( - validateOption, + validateFlag, negatable: false, help: 'Validate packages and indicate whether --publish would publish ' 'anything.', ) ..addFlag( - publishOption, + publishFlag, negatable: false, help: 'Publish any changed packages.', ) ..addFlag( - useFlutterOption, + useFlutterFlag, negatable: true, help: 'Whether this is a Flutter project.', );