-
-
Notifications
You must be signed in to change notification settings - Fork 98
145 lines (139 loc) · 6.49 KB
/
deploy.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# This GitHub action runs on a release, when the GitHub repo is "published"
# This workflow:
# - Installs dart and flutter
# - Uses flutter stable channel.
# Consider setting up a matrix later with beta and dev included too.
# - Enables flutter web
# - Gets package dependencies
# - Runs dart analyze.
# - Show outdated packages, just added for info.
# - Verify that dart format is used by all committed code, fails if not.
# Controversial but pub.dev penalizes you if dart format is not used.
# - Run all tests with coverage.
# - Upload code coverage output to Codecov for analysis.
# - Build 5 different WEB example apps using FlexColorScheme.
# All examples use these steps:
# - Flutter clean.
# - Flutter build web app, in release mode and with html renderer.
# - Use rpl to fix/modify the index.html file to give it the correct
# href deployment sub-folder.
# - Deploy each built Web App to GitHub pages.
name: Deploy_Web
on:
push:
branches: [none]
paths-ignore:
- "**.md"
pull_request:
branches: [none]
paths-ignore:
- "**.md"
release:
branches: [none]
types: [published]
jobs:
flutter_tests:
name: "Analyze and test package, then build and deploy 5 web apps"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Flutter and Dart SDK
uses: subosito/flutter-action@v2
with:
channel: "stable"
- name: "Show Dart SDK version"
run: dart --version
- name: "Show Flutter SDK version"
run: flutter --version
- name: "Flutter Enable Web"
run: flutter config --enable-web
- name: "Install Flutter package dependencies"
run: flutter pub get
- name: "Analyze Dart source"
run: dart analyze
- name: "Show outdated packages"
run: flutter pub outdated
- name: "Verify that Dart formatting is used, fail if not"
run: dart format --output=none --set-exit-if-changed .
- name: "Test package FlexColorScheme with coverage"
run: flutter test --coverage
- name: "Upload test coverage to Codecov"
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage/lcov.info
# Example 1 Basic theme - Build and deploy
- name: "EXAMPLE-1 START BUILD - Flutter clean before build"
run: flutter clean && cd example && flutter clean
- name: "EXAMPLE-1 WEB release build"
run: cd example && flutter build web --web-renderer canvaskit --base-href "/flexcolorscheme/basictheme-latest/" --release -t lib/example1_basic_theme_usage/main.dart
- name: "EXAMPLE-1 DEPLOY to GitHub Pages repository, published on commit."
uses: dmnemec/copy_file_to_another_repo_action@v1.0.4
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source_file: 'example/build/web/.'
destination_folder: 'flexcolorscheme/basictheme-latest'
destination_repo: 'rydmike/rydmike.github.io'
user_email: 'm.rydstrom@gmail.com'
user_name: 'rydmike'
# Example 2 Custom theme - Build and deploy
- name: "EXAMPLE-2 START BUILD - Flutter clean before build"
run: flutter clean && cd example && flutter clean
- name: "EXAMPLE-2 WEB release build"
run: cd example && flutter build web --web-renderer canvaskit --base-href "/flexcolorscheme/customtheme-latest/" --release -t lib/example2_custom_theme/main.dart
- name: "EXAMPLE-2 DEPLOY to GitHub Pages repository, published on commit."
uses: dmnemec/copy_file_to_another_repo_action@v1.0.4
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source_file: 'example/build/web/.'
destination_folder: 'flexcolorscheme/customtheme-latest'
destination_repo: 'rydmike/rydmike.github.io'
user_email: 'm.rydstrom@gmail.com'
user_name: 'rydmike'
# Example 3 Four themes - Build and deploy
- name: "EXAMPLE-3 START BUILD - Flutter clean before build"
run: flutter clean && cd example && flutter clean
- name: "EXAMPLE-3 WEB release build"
run: cd example && flutter build web --web-renderer canvaskit --base-href "/flexcolorscheme/fourthemes-latest/" --release -t lib/example3_four_themes/main.dart
- name: "EXAMPLE-3 DEPLOY to GitHub Pages repository, published on commit."
uses: dmnemec/copy_file_to_another_repo_action@v1.0.4
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source_file: 'example/build/web/.'
destination_folder: 'flexcolorscheme/fourthemes-latest'
destination_repo: 'rydmike/rydmike.github.io'
user_email: 'm.rydstrom@gmail.com'
user_name: 'rydmike'
# Example 4 All themes - Build and deploy
- name: "EXAMPLE-4 START BUILD - Flutter clean before build"
run: flutter clean && cd example && flutter clean
- name: "EXAMPLE-4 WEB release build"
run: cd example && flutter build web --web-renderer canvaskit --base-href "/flexcolorscheme/allthemes-latest/" --release -t lib/example4_all_themes/main.dart
- name: "EXAMPLE-4 DEPLOY to GitHub Pages repository, published on commit."
uses: dmnemec/copy_file_to_another_repo_action@v1.0.4
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source_file: 'example/build/web/.'
destination_folder: 'flexcolorscheme/allthemes-latest'
destination_repo: 'rydmike/rydmike.github.io'
user_email: 'm.rydstrom@gmail.com'
user_name: 'rydmike'
# Example 5 Themes playground - Build and deploy
- name: "EXAMPLE-5 START BUILD - Flutter clean before build"
run: flutter clean && cd example && flutter clean
- name: "EXAMPLE-5 WEB release build"
run: cd example && flutter build web --web-renderer canvaskit --base-href "/flexcolorscheme/themesplayground-latest/" --no-tree-shake-icons --release -t lib/example5_themes_playground/main.dart
- name: "EXAMPLE-5 DEPLOY to GitHub Pages repository, published on commit."
uses: dmnemec/copy_file_to_another_repo_action@v1.0.4
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source_file: 'example/build/web/.'
destination_folder: 'flexcolorscheme/themesplayground-latest'
destination_repo: 'rydmike/rydmike.github.io'
user_email: 'm.rydstrom@gmail.com'
user_name: 'rydmike'