Skip to content

Commit

Permalink
fix(actions): Updated actions to push changelog to zeta. (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Feb 17, 2023
1 parent b0ad7f1 commit f7a8d9a
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 146 deletions.
67 changes: 39 additions & 28 deletions .github/workflows/onMerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 0 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## 0.0.1
## 0.0.1+1

- Grid
- Initial setup
35 changes: 0 additions & 35 deletions android/src/main/kotlin/com/zebra/zeta/zeta/ZetaPlugin.kt

This file was deleted.

This file was deleted.

14 changes: 8 additions & 6 deletions example/lib/example_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
),
),
),
Expand Down
71 changes: 37 additions & 34 deletions example/lib/pages/grid_example.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

import '../example_scaffold.dart';

class _GridExampleModel {
Expand All @@ -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'),
Expand All @@ -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,
Expand All @@ -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()),
Expand All @@ -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(),
);
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion lib/src/components/grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down

0 comments on commit f7a8d9a

Please sign in to comment.