-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (79 loc) · 2.39 KB
/
Copy pathmain.yml
File metadata and controls
96 lines (79 loc) · 2.39 KB
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
name: Flutter CI / Deploy Web
on:
push:
branches: [main]
tags: ['v*.*.*']
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
name: Build & Test
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache pub deps
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: ${{ runner.os }}-pub-
- name: Setup Java (Temurin 17)
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.38.10
cache: true
- name: Get dependencies
run: flutter pub get
- name: Run build_runner
run: dart run build_runner build --delete-conflicting-outputs
- name: Analyze Dart code
run: flutter analyze
- name: Run tests
run: flutter test --no-pub --coverage
- name: Build web (release)
run: flutter build web --release --base-href "/"
- name: Upload web artifact
uses: actions/upload-artifact@v4
with:
name: web-build
path: build/web
if-no-files-found: error
deploy:
name: Deploy to GitHub Pages
needs: ci
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: MY_PAT
permissions:
contents: read
steps:
- name: Download web artifact
uses: actions/download-artifact@v4
with:
name: web-build
path: build/web
- name: Deploy to VVK027.github.io
uses: peaceiris/actions-gh-pages@v4
with:
# PAT needs repo scope on VVK027/VVK027.github.io (Settings → Secrets → MY_PAT)
personal_token: ${{ secrets.MY_PAT }}
external_repository: VVK027/vvk027.github.io
publish_dir: ./build/web
publish_branch: main
- name: Show deployed URL
run: |
echo "### Deployed successfully" >> "$GITHUB_STEP_SUMMARY"
echo "**Live URL:** https://vvk027.github.io/" >> "$GITHUB_STEP_SUMMARY"