From f7a8d9a2ba078bf08fe80de07f6e9c871af9e451 Mon Sep 17 00:00:00 2001 From: Luke Walton Date: Fri, 17 Feb 2023 16:43:34 +0000 Subject: [PATCH] fix(actions): Updated actions to push changelog to zeta. (#6) --- .github/workflows/onMerge.yml | 67 +++++++++-------- .github/workflows/pr.yml | 4 -- CHANGELOG.md | 4 +- .../kotlin/com/zebra/zeta/zeta/ZetaPlugin.kt | 35 --------- .../zeta/zeta_flutter/ZetaFlutterPlugin.kt | 35 --------- example/lib/example_scaffold.dart | 14 ++-- example/lib/pages/grid_example.dart | 71 ++++++++++--------- example/pubspec.lock | 2 +- lib/src/components/grid.dart | 2 +- 9 files changed, 88 insertions(+), 146 deletions(-) delete mode 100644 android/src/main/kotlin/com/zebra/zeta/zeta/ZetaPlugin.kt delete mode 100644 android/src/main/kotlin/com/zebra/zeta/zeta_flutter/ZetaFlutterPlugin.kt diff --git a/.github/workflows/onMerge.yml b/.github/workflows/onMerge.yml index 7d81cce0..92eabcb8 100644 --- a/.github/workflows/onMerge.yml +++ b/.github/workflows/onMerge.yml @@ -8,13 +8,11 @@ jobs: update-version: if: github.event.pull_request.merged runs-on: ubuntu-latest - timeout-minutes: 20 + timeout-minutes: 5 steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 ref: main - persist-credentials: false - name: Change flutter version tag uses: BentEngbers/flutter-change-version@v1.0.3 - name: push change @@ -27,43 +25,56 @@ jobs: git commit --amend --no-edit git push -f - build-website: + publish_changelog: + needs: update-version if: github.event.pull_request.merged runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 ref: main - persist-credentials: false - - uses: subosito/flutter-action@v2 - with: - channel: "stable" - - name: Setup dart / flutter - run: | - flutter pub get - dart pub global activate dartdoc - - name: Make zeta-flutter build repo - run: | - mkdir -p build/{example,dartdoc,widgetbook} - - name: Build outputs - run: | - dartdoc --output build/dartdoc - cd example - flutter build web --base-href='/flutter/widgetbook/' -t widgetbook/main.dart -o ../build/widgetbook - flutter build web --base-href='/flutter/example/' -t lib/main.dart -o ../build/example - cd .. - id: read-version uses: NiklasLehnfeld/flutter-version-number-action@main - - name: Create pull request - uses: paygoc6/action-pull-request-another-repo@v1.0.1 + - name: Create tag + uses: actions/github-script@v5 + with: + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/${{steps.read-version.outputs.version-number}}', + sha: "${{github.sha}}" + }) + - name: Update CHANGELOG + id: changelog + uses: requarks/changelog-action@v1 + with: + token: ${{ secrets.PAT }} + tag: ${{ steps.read-version.outputs.version-number }} + excludeTypes: "" + includeInvalidCommits: true + - name: Make changelog flutter + run: cp CHANGELOG.md CHANGELOG_FLUTTER.md + - name: Push changelog to Zeta + uses: dmnemec/copy_file_to_another_repo_action@main env: API_TOKEN_GITHUB: ${{ secrets.PAT }} with: - source_folder: "build" - destination_folder: "hosting/public/flutter" + source_file: "CHANGELOG_FLUTTER.md" destination_repo: "zebratechnologies/zeta" - destination_head_branch: "flutter/${{ steps.read-version.outputs.version-number }}" + destination_folder: "./" + destination_branch_create: "flutter/${{ steps.read-version.outputs.version-number }}" user_email: "github-actions@github.com" user_name: "github-actions" + - name: Open Zeta PR + uses: thecanadianroot/open-pull-request-action@v1.0.3 + with: + token: ${{secrets.PAT}} + base: main + head: "flutter/${{ steps.read-version.outputs.version-number }}" + title: "flutter/${{ steps.read-version.outputs.version-number }}" + labels: flutter + reviewers: benken + owner: zebratechnologies + repository: zebratechnologies/zeta diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 36554f66..557fef6d 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -24,10 +24,6 @@ jobs: - name: Get branch name id: branch-name uses: tj-actions/branch-names@v5.1 - - uses: actions/setup-java@v3 - with: - java-version: "12.x" - distribution: "adopt-openj9" - uses: subosito/flutter-action@v2 with: flutter-version: "3.7.x" diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a484d64..29eadbf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.0.1 +## 0.0.1+1 -- Grid +- Initial setup diff --git a/android/src/main/kotlin/com/zebra/zeta/zeta/ZetaPlugin.kt b/android/src/main/kotlin/com/zebra/zeta/zeta/ZetaPlugin.kt deleted file mode 100644 index 855c3b81..00000000 --- a/android/src/main/kotlin/com/zebra/zeta/zeta/ZetaPlugin.kt +++ /dev/null @@ -1,35 +0,0 @@ -package com.zebra.zeta.zeta - -import androidx.annotation.NonNull - -import io.flutter.embedding.engine.plugins.FlutterPlugin -import io.flutter.plugin.common.MethodCall -import io.flutter.plugin.common.MethodChannel -import io.flutter.plugin.common.MethodChannel.MethodCallHandler -import io.flutter.plugin.common.MethodChannel.Result - -/** ZetaPlugin */ -class ZetaPlugin: FlutterPlugin, MethodCallHandler { - /// The MethodChannel that will the communication between Flutter and native Android - /// - /// This local reference serves to register the plugin with the Flutter Engine and unregister it - /// when the Flutter Engine is detached from the Activity - private lateinit var channel : MethodChannel - - override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { - channel = MethodChannel(flutterPluginBinding.binaryMessenger, "zeta") - channel.setMethodCallHandler(this) - } - - override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { - if (call.method == "getPlatformVersion") { - result.success("Android ${android.os.Build.VERSION.RELEASE}") - } else { - result.notImplemented() - } - } - - override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { - channel.setMethodCallHandler(null) - } -} diff --git a/android/src/main/kotlin/com/zebra/zeta/zeta_flutter/ZetaFlutterPlugin.kt b/android/src/main/kotlin/com/zebra/zeta/zeta_flutter/ZetaFlutterPlugin.kt deleted file mode 100644 index bf480306..00000000 --- a/android/src/main/kotlin/com/zebra/zeta/zeta_flutter/ZetaFlutterPlugin.kt +++ /dev/null @@ -1,35 +0,0 @@ -package com.zebra.zeta.zeta_flutter - -import androidx.annotation.NonNull - -import io.flutter.embedding.engine.plugins.FlutterPlugin -import io.flutter.plugin.common.MethodCall -import io.flutter.plugin.common.MethodChannel -import io.flutter.plugin.common.MethodChannel.MethodCallHandler -import io.flutter.plugin.common.MethodChannel.Result - -/** ZetaFlutterPlugin */ -class ZetaFlutterPlugin: FlutterPlugin, MethodCallHandler { - /// The MethodChannel that will the communication between Flutter and native Android - /// - /// This local reference serves to register the plugin with the Flutter Engine and unregister it - /// when the Flutter Engine is detached from the Activity - private lateinit var channel : MethodChannel - - override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { - channel = MethodChannel(flutterPluginBinding.binaryMessenger, "zeta_flutter") - channel.setMethodCallHandler(this) - } - - override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { - if (call.method == "getPlatformVersion") { - result.success("Android ${android.os.Build.VERSION.RELEASE}") - } else { - result.notImplemented() - } - } - - override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { - channel.setMethodCallHandler(null) - } -} diff --git a/example/lib/example_scaffold.dart b/example/lib/example_scaffold.dart index f92af2c7..c4f955c2 100644 --- a/example/lib/example_scaffold.dart +++ b/example/lib/example_scaffold.dart @@ -13,12 +13,14 @@ class ExampleScaffold extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text(name)), - body: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.only(top: 8, bottom: 32), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: children, + body: SelectionArea( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.only(top: 8, bottom: 32), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: children, + ), ), ), ), diff --git a/example/lib/pages/grid_example.dart b/example/lib/pages/grid_example.dart index c744ea8e..14883e21 100644 --- a/example/lib/pages/grid_example.dart +++ b/example/lib/pages/grid_example.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; - import '../example_scaffold.dart'; class _GridExampleModel { @@ -24,7 +23,7 @@ class _GridExampleModel { class GridExample extends StatelessWidget implements ExampleWidget { final List<_GridExampleModel> _gridExamples = [ const _GridExampleModel(12, null, false, 'Basic 12 col grid'), - const _GridExampleModel(12, null, true, 'Basic 12 col grid'), + const _GridExampleModel(12, null, true, 'Basic 12 col grid gapless'), const _GridExampleModel(2, null, false, '2 col grid'), const _GridExampleModel(4, null, false, '4 col grid'), const _GridExampleModel(8, null, false, '8 col grid'), @@ -45,17 +44,16 @@ class GridExample extends StatelessWidget implements ExampleWidget { const _GridExampleModel(12, 3, false, '3 to 9 grid'), const _GridExampleModel(12, 2, false, '2 to 10 grid'), const _GridExampleModel(12, 1, false, '1 to 11 grid'), - const _GridExampleModel(12, 11, true, '11 to 1 grid gapless '), - const _GridExampleModel(12, 10, true, '10 to 2 grid gapless '), - const _GridExampleModel(12, 9, true, '9 to 3 grid gapless '), - const _GridExampleModel(12, 8, true, '8 to 4 grid gapless '), - const _GridExampleModel(12, 7, true, '7 to 5 grid gapless '), - const _GridExampleModel(12, 5, true, '5 to 7 grid gapless '), - const _GridExampleModel(12, 4, true, '4 to 8 grid gapless '), - const _GridExampleModel(12, 3, true, '3 to 9 grid gapless '), - const _GridExampleModel(12, 2, true, '2 to 10 grid gapless '), - const _GridExampleModel(12, 1, true, '1 to 11 grid gapless '), - const _GridExampleModel(12, 1, true, '1 to 11 grid gapless '), + const _GridExampleModel(12, 11, true, '11 to 1 grid gapless'), + const _GridExampleModel(12, 10, true, '10 to 2 grid gapless'), + const _GridExampleModel(12, 9, true, '9 to 3 grid gapless'), + const _GridExampleModel(12, 8, true, '8 to 4 grid gapless'), + const _GridExampleModel(12, 7, true, '7 to 5 grid gapless'), + const _GridExampleModel(12, 5, true, '5 to 7 grid gapless'), + const _GridExampleModel(12, 4, true, '4 to 8 grid gapless'), + const _GridExampleModel(12, 3, true, '3 to 9 grid gapless'), + const _GridExampleModel(12, 2, true, '2 to 10 grid gapless'), + const _GridExampleModel(12, 1, true, '1 to 11 grid gapless'), const _GridExampleModel( 8, null, @@ -76,8 +74,8 @@ class GridExample extends StatelessWidget implements ExampleWidget { const _GridExampleModel( 8, null, - false, - 'Hybrid', + true, + 'Hybrid gapless', [ GridItem(width: 120), Flexible(child: GridItem()), @@ -100,25 +98,30 @@ class GridExample extends StatelessWidget implements ExampleWidget { return ExampleScaffold( name: name, children: _gridExamples.map((e) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(e.name, style: Theme.of(context).textTheme.headlineSmall), - ZetaGrid( - col: e.col, - noGaps: e.noGaps, - asymmetricWeight: e.asymmetric, - children: e.children != null ? e.children! : gridItems, - ), - Container( - color: const Color(0xFFE9E9E9), - padding: const EdgeInsets.all(16), - child: Text( - 'ZetaGrid(${e.col != 12 ? 'col:${e.col},' : ''}${e.noGaps ? 'noGaps:true,' : ''}${e.asymmetric != null ? 'asymmetricWeight:${e.asymmetric},' : ''}${e.children != null ? 'children:${e.childrenText},' : ''})', - style: Theme.of(context).textTheme.bodyMedium), - ), - const SizedBox(height: 40), - ], + return Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(e.name, style: Theme.of(context).textTheme.headlineSmall), + ZetaGrid( + col: e.col, + noGaps: e.noGaps, + asymmetricWeight: e.asymmetric, + hybrid: e.children != null, + children: e.children != null ? e.children! : gridItems, + ), + Container( + color: const Color(0xFFE9E9E9), + padding: const EdgeInsets.all(16), + margin: const EdgeInsets.only(left: 16), + child: Text( + 'ZetaGrid(${e.col != 12 ? 'col:${e.col},' : ''}${e.noGaps ? 'noGaps:true, ' : ''}${e.asymmetric != null ? 'asymmetricWeight:${e.asymmetric}, ' : ''}${e.children != null ? 'hybrid: true, ' : ''}${e.children != null ? 'children:${e.childrenText}, ' : ''})', + style: Theme.of(context).textTheme.bodyMedium), + ), + const SizedBox(height: 40), + ], + ), ); }).toList(), ); diff --git a/example/pubspec.lock b/example/pubspec.lock index 3bb85533..fd705d0d 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -259,7 +259,7 @@ packages: path: ".." relative: true source: path - version: "0.0.1+2" + version: "0.0.1+4" sdks: dart: ">=2.19.1 <3.0.0" flutter: ">=2.5.0" diff --git a/lib/src/components/grid.dart b/lib/src/components/grid.dart index ceefd503..d0fd4cb9 100644 --- a/lib/src/components/grid.dart +++ b/lib/src/components/grid.dart @@ -49,7 +49,7 @@ extension _Spacing on DeviceType { } } -/// Zeta Grid component +/// Zeta Grid class ZetaGrid extends StatelessWidget { /// Number of columns in grid. Should be an even number between 2 and 16, although values above 12 should be used sparingly. ///