-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (82 loc) · 3.3 KB
/
generate_templates.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: generate_templates
on:
workflow_dispatch: {}
push:
branches:
- main
paths:
- .github/workflows/generate_templates.yaml
- bricks/**/brick-gen.json
- bricks/**/reference/**
- tools/brick_generator/**
jobs:
identify-brick-scopes:
name: Identify brick scopes
runs-on: ubuntu-latest
outputs:
scopes: ${{ steps.identify-brick-scopes.outputs.scopes }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.27.3
- name: Install melos
run: dart pub global activate melos 7.0.0-dev.5
- name: Initialize melos
run: melos bs --category=scopes
- name: Identify brick scopes
id: identify-brick-scopes
run: echo "scopes=$(melos list --category=scopes --json | tr -d '\n')" >> "$GITHUB_OUTPUT"
- name: List identified scopes
run: echo "${{ join(steps.identify-brick-scopes.outputs.scopes.*.name, ', ') }}"
generate-templates:
name: Generate templates for the identified scopes
runs-on: ubuntu-latest
needs: identify-brick-scopes
strategy:
matrix:
scope: ${{fromJson(needs.identify-brick-scopes.outputs.scopes)}}
steps:
- name: Build brick scope name
id: build-brick-scope-name
run: echo "brick-scope-name=$(echo ${{ matrix.scope.name }})" >> "$GITHUB_OUTPUT"
- name: Build brick name
id: build-brick-name
run: echo "brick-name=$(echo ${{ steps.build-brick-scope-name.outputs.brick-scope-name }} | sed 's/_brick_scope//g')" >> "$GITHUB_OUTPUT"
- name: Build brick tag name
id: build-brick-tag-name
run: echo "brick-tag-name=$(echo ${{ steps.build-brick-name.outputs.brick-name }} | sed 's/_/-/g')" >> "$GITHUB_OUTPUT"
- name: Check out repository
uses: actions/checkout@v4
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.27.3
- name: Install melos
run: dart pub global activate melos 7.0.0-dev.5
- name: Initialize brick generator
run: melos bs --scope=brick_generator
- name: Set brick scope as unique relevant packages
run: echo "MELOS_PACKAGES=${{ steps.build-brick-scope-name.outputs.brick-scope-name }}" >> "$GITHUB_ENV"
- name: Generate template
run: melos run brick.gen
- name: Create PR
uses: peter-evans/create-pull-request@v7
with:
base: main
add-paths: |
./bricks/${{ steps.build-brick-name.outputs.brick-name }}/brick/__brick__/**
branch: chore/${{ steps.build-brick-tag-name.outputs.brick-tag-name }}/update-template
commit-message: 'chore(b-${{ steps.build-brick-tag-name.outputs.brick-tag-name }}): update template'
title: 'chore(b-${{ steps.build-brick-tag-name.outputs.brick-tag-name }}): update template'
body: Update template.
delete-branch: true
labels: |
bot
b:${{ steps.build-brick-tag-name.outputs.brick-tag-name }}
author: Altoke Bot <[email protected]>
committer: Altoke Bot <[email protected]>
assignees: mrverdant13
reviewers: mrverdant13