-
Notifications
You must be signed in to change notification settings - Fork 158
77 lines (63 loc) · 2.65 KB
/
google_fonts_update.yml
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
# Runs a generator script to update the fonts in the google_fonts package.
# Updates the CHANGELOG, pubspec, and creates a pull request if there are changes.
name: Update google_fonts' fonts
on:
schedule:
- cron: "30 1 1,15 * *"
workflow_dispatch: # Enable manual run from Github
# Declare default permissions as read only.
permissions: read-all
jobs:
update-fonts:
runs-on: ubuntu-latest
permissions:
pull-requests: write
actions: write # Required for the cancel action
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Clone Flutter repository with beta channel
uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v1.5.3
with:
channel: beta
cache: true
- run: flutter pub get
working-directory: packages/google_fonts
- run: dart pub global activate cider
- run: dart generator/generator.dart
working-directory: packages/google_fonts
- run: cider version
id: new_version
working-directory: packages/google_fonts
- run: dart format
working-directory: packages/google_fonts
- name: Read families_diff file
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: get_families_diff
with:
script: |
const fs = require('fs');
return fs.readFileSync('packages/google_fonts/generator/families_diff','utf8').toString();
result-encoding: string
- name: Cancel workflow if there is no diff
uses: andymckay/cancel-action@a955d435292c0d409d104b57d8e78435a93a6ef1 # v0.5
if: steps.get_families_diff.outputs.result == ''
- name: If cancelling workflow, allow for enough time to do so
run: sleep 15s
shell: bash
if: steps.get_families_diff.outputs.result == ''
- uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
token: ${{ secrets.MATERIAL_ROBOT_TOKEN }}
committer: material-robot <[email protected]>
commit-message: |
[google_fonts] update fonts
${{ steps.get_families_diff.outputs.result }}
base: main
branch: create-pull-request/update
delete-branch: true
author: material-robot <[email protected]>
title: Update `google_fonts` to ${{ steps.new_version.outputs.result }}
body: |
# Summary
${{ steps.get_families_diff.outputs.result }}
Please note that all existing fonts are subject to being updated.