|
1 |
| -# This workflow uses actions that are not certified by GitHub. |
2 |
| -# They are provided by a third-party and are governed by |
3 |
| -# separate terms of service, privacy policy, and support |
4 |
| -# documentation. |
5 |
| - |
6 |
| -name: Dart |
| 1 | +name: Flutter Web Build and Deploy |
7 | 2 |
|
8 | 3 | on:
|
9 | 4 | push:
|
|
12 | 7 | branches: [ "master" ]
|
13 | 8 |
|
14 | 9 | jobs:
|
15 |
| - build: |
| 10 | + build-and-deploy: |
16 | 11 | runs-on: ubuntu-latest
|
17 | 12 |
|
18 | 13 | steps:
|
| 14 | + # 检出代码 |
19 | 15 | - uses: actions/checkout@v4
|
20 | 16 |
|
21 |
| - # Note: This workflow uses the latest stable version of the Dart SDK. |
22 |
| - # You can specify other versions if desired, see documentation here: |
23 |
| - # https://github.com/dart-lang/setup-dart/blob/main/README.md |
24 |
| - # - uses: dart-lang/setup-dart@v1 |
| 17 | + # 设置 Dart/Flutter 环境 |
25 | 18 | - uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603
|
26 | 19 |
|
| 20 | + # 安装依赖项 |
27 | 21 | - name: Install dependencies
|
28 |
| - run: dart pub get |
29 |
| - |
30 |
| - # Uncomment this step to verify the use of 'dart format' on each commit. |
31 |
| - # - name: Verify formatting |
32 |
| - # run: dart format --output=none --set-exit-if-changed . |
33 |
| - |
34 |
| - # Consider passing '--fatal-infos' for slightly stricter analysis. |
35 |
| - - name: Analyze project source |
36 |
| - run: dart analyze |
37 |
| - |
38 |
| - # Your project will need to have tests in test/ and a dependency on |
39 |
| - # package:test for this step to succeed. Note that Flutter projects will |
40 |
| - # want to change this to 'flutter test'. |
41 |
| - - name: Run tests |
42 |
| - run: dart test |
| 22 | + run: flutter pub get |
| 23 | + |
| 24 | + # 构建 Flutter Web 项目 |
| 25 | + - name: Build Flutter Web |
| 26 | + run: flutter build web --release |
| 27 | + |
| 28 | + # 部署到 GitHub Pages |
| 29 | + - name: Deploy to GitHub Pages |
| 30 | + uses: peaceiris/actions-gh-pages@v4 |
| 31 | + with: |
| 32 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + publish_dir: build/web |
0 commit comments