From 7207dbf5323b01e686026939c7865f7127bc7301 Mon Sep 17 00:00:00 2001 From: Ellet Date: Tue, 5 Dec 2023 08:25:22 +0300 Subject: [PATCH] 2 --- .github/workflows/publish.yml | 21 +++++++++++++--- doc/translation.md | 2 +- flutter_quill_extensions/pubspec.yaml | 2 +- flutter_quill_test/pubspec.yaml | 2 +- pubspec.yaml | 1 + ...slations.sh => regenerate_translations.sh} | 2 +- scripts/regenerate_versions.dart | 24 +++++++++++++++++++ version.dart | 1 + 8 files changed, 48 insertions(+), 7 deletions(-) rename scripts/{regenerate-translations.sh => regenerate_translations.sh} (87%) create mode 100644 scripts/regenerate_versions.dart create mode 100644 version.dart diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 87fec683..bc01a66c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,15 +27,30 @@ jobs: # - run: dart tool/generate-code.dart - name: Re-generate the translations - run: ./scripts/regenerate-translations.sh - + run: ./scripts/regenerate_translations.sh + + - name: Re-generate the versions + run: dart ./scripts/regenerate_versions.dart # This is needed in order for the authentication to success # dart pub token add https://pub.dev --env-var PUB_TOKEN # Requests to "https://pub.dev" will now be authenticated using the secret token stored in the environment variable "PUB_TOKEN". - uses: dart-lang/setup-dart@v1 + ## dart-lang/setup-dart/.github/workflows/publish.yml@v1 # - name: Update the authorization requests to "https://pub.dev" to use the environment variable "PUB_TOKEN". # run: dart pub token add https://pub.dev --env-var PUB_TOKEN - - name: Publish + - name: Publish flutter_quill + run: flutter pub publish --force + + - name: Publish flutter_quill_extensions + run: flutter pub publish --force + working-directory: ./flutter_quill_extensions + + - name: Publish flutter_quill_test + run: flutter pub publish --force + working-directory: ./flutter_quill_test + + - name: Publish quill_html_converter run: flutter pub publish --force + working-directory: ./packages/quill_html_converter diff --git a/doc/translation.md b/doc/translation.md index 5bdaf542..5d801ba8 100644 --- a/doc/translation.md +++ b/doc/translation.md @@ -56,7 +56,7 @@ flutter gen-l10n or: ``` -./scripts/regenerate-translations.sh +./scripts/regenerate_translations.sh ``` diff --git a/flutter_quill_extensions/pubspec.yaml b/flutter_quill_extensions/pubspec.yaml index 254d628a..6ceffb04 100644 --- a/flutter_quill_extensions/pubspec.yaml +++ b/flutter_quill_extensions/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill_extensions description: Embed extensions for flutter_quill including image, video, formula and etc. -version: 0.8.0-dev +version: 9.0.0-dev homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/ repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ diff --git a/flutter_quill_test/pubspec.yaml b/flutter_quill_test/pubspec.yaml index 2c18005a..19263386 100644 --- a/flutter_quill_test/pubspec.yaml +++ b/flutter_quill_test/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill_test description: Test utilities for flutter_quill which includes methods to simplify interacting with the editor in test cases. -version: 0.0.5 +version: 9.0.0-dev homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/ repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/ issue_tracker: https://github.com/singerdmx/flutter-quill/issues/ diff --git a/pubspec.yaml b/pubspec.yaml index d4e53d69..2351f76f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -65,6 +65,7 @@ dev_dependencies: flutter_quill_test: ^0.0.4 test: ^1.24.3 intl_translation: ^0.18.2 + yaml_edit: ^2.1.1 flutter: uses-material-design: true diff --git a/scripts/regenerate-translations.sh b/scripts/regenerate_translations.sh similarity index 87% rename from scripts/regenerate-translations.sh rename to scripts/regenerate_translations.sh index 1f7c26e5..8e1583bf 100755 --- a/scripts/regenerate-translations.sh +++ b/scripts/regenerate_translations.sh @@ -1,7 +1,7 @@ #!/bin/bash # Important: make sure to run the script in the root folder of the repo: -# ./scripts/regenerate-translations.sh +# ./scripts/regenerate_translations.sh # otherwise the script could delete the wrong folder in rare cases echo "" diff --git a/scripts/regenerate_versions.dart b/scripts/regenerate_versions.dart new file mode 100644 index 00000000..b233c54b --- /dev/null +++ b/scripts/regenerate_versions.dart @@ -0,0 +1,24 @@ +import 'dart:io' show File; + +import 'package:yaml_edit/yaml_edit.dart'; + +// You must run this script in the root folder of the repo and not inside the scripts + +// ignore: unused_import +import '../version.dart'; + +Future main(List args) async { + await updatePubspecYamlFile('./pubspec.yaml'); + await updatePubspecYamlFile('./flutter_quill_extensions/pubspec.yaml'); + await updatePubspecYamlFile('./flutter_quill_test/pubspec.yaml'); + await updatePubspecYamlFile('./packages/quill_html_converter/pubspec.yaml'); +} + +Future updatePubspecYamlFile(String path) async { + final file = File(path); + final yaml = await file.readAsString(); + final yamlEditor = YamlEditor(yaml)..update(['version'], version); + await file.writeAsString(yamlEditor.toString()); + // ignore: avoid_print + print(yamlEditor.toString()); +} diff --git a/version.dart b/version.dart new file mode 100644 index 00000000..207b9df3 --- /dev/null +++ b/version.dart @@ -0,0 +1 @@ +const version = '9.0.0-dev';