-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 1.52 KB
/
main.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
name: On Website Deploy
"on":
push:
branches:
- "main"
paths:
- 'example/lib/**'
- 'example/web/**'
- 'lib/**'
- 'pubspec.yaml'
- '.github/workflows/main.yml'
jobs:
build_and_deploy_web:
name: Build & Deploy Flutter to Web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: 🌍 Enable Web
run: |
cd ./example
flutter config --enable-web
- name: 📦 Get packages
run: |
cd ./example
flutter pub get
- name: 🏭 Build Web Application
run: |
cd ./example
flutter build web --release
- name: Checkout Destination Repository
uses: actions/checkout@v2
with:
repository: flutter-task-manager/flutter-task-manager.github.io
token: ${{ secrets.PAT }}
path: 'destination_repo'
- name: Copy Files to Destination Repository
run: |
# 删除 destination_repo 目录下除了 .git 以外的所有文件
find destination_repo -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} \;
cp -r example/build/web/* destination_repo/
- name: Commit and Push
run: |
cd destination_repo
git config --local user.email "[email protected]"
git config --local user.name "cezres"
git add .
git commit -m "Update files"
git push --force