forked from cfug/flutter.cn
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (123 loc) · 4.02 KB
/
build.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: build
on:
push:
branches:
- main
pull_request:
branches:
- main
# Declare default permissions as read only.
permissions: read-all
env:
NODE_ENV: production
NODE_VERSION: 20
jobs:
test:
name: Analyze and test code examples
runs-on: ubuntu-latest
if: github.repository == 'cfug/flutter.cn'
strategy:
fail-fast: false
matrix:
include:
- name: "Beta channel"
branch: beta
experimental: true
- name: "Stable channel"
branch: stable
experimental: false
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
submodules: recursive
- name: Move docs
run: make move-docs
- uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225
with:
channel: ${{ matrix.branch }}
- name: Fetch Dart dependencies
run: dart pub get
- name: Check Dart code formatting
run: dart run flutter_site format-dart --check
continue-on-error: ${{ matrix.experimental }}
- name: Analyze Dart code
run: dart run flutter_site analyze-dart
continue-on-error: ${{ matrix.experimental }}
- name: Run Dart tests
run: dart run flutter_site test-dart
continue-on-error: ${{ matrix.experimental }}
excerpts:
name: Check if code excerpts are up to date
runs-on: ubuntu-latest
if: github.repository == 'cfug/flutter.cn'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
submodules: recursive
- uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: stable
- name: Fetch Dart dependencies
run: dart pub get
- name: Check if excerpts are up to date
run: dart run flutter_site refresh-excerpts --fail-on-update
continue-on-error: ${{ matrix.experimental }}
linkcheck:
name: Build site and check links
runs-on: ubuntu-latest
if: |
github.repository == 'cfug/flutter.cn'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
submodules: recursive
- name: Build site and check links
run: make build BUILD_CONFIGS=_config.yml,_config_stage.yml
- name: Install Node for Firebase install
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install Firebase CLI
run: npm install -g [email protected]
- uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: stable
- name: Fetch Dart dependencies
run: dart pub get
- name: Check for broken Markdown link references
run: dart run flutter_site check-link-references
- name: Check for broken internal links
run: dart run flutter_site check-links
firebase-validate:
name: Validate Firebase configuration
runs-on: ubuntu-latest
if: github.repository == 'cfug/flutter.cn'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
submodules: recursive
- uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: stable
- name: Fetch Dart dependencies
run: dart pub get
- name: Validate the firebase.json file
run: dart run flutter_site verify-firebase-json
deploy:
name: Deploy to production
needs: [test, excerpts, linkcheck, firebase-validate]
runs-on: ubuntu-latest
if: |
github.event_name == 'push'
&& github.ref == 'refs/heads/main'
&& github.repository == 'cfug/flutter.cn'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
submodules: recursive
- name: Build site
run: make build
- name: Deploy CN
run: make deploy
env:
DEPLOY_TOKEN: ${{ secrets.CHENGLU_DEPLOY_KEY }}