-
-
Notifications
You must be signed in to change notification settings - Fork 4
107 lines (95 loc) · 3.24 KB
/
example-deploy-production.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
name: Example - deploy web on live channel
on:
workflow_dispatch:
jobs:
build:
#if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
name: "Build"
runs-on: ubuntu-latest
container:
image: plugfox/flutter:stable-web
options: --user root
timeout-minutes: 30
env:
working-directory: ./example
steps:
- name: 🚂 Get latest code
uses: actions/checkout@v3
- name: 🗄️ Export pub cache directory
run: |
git config --global --add safe.directory /opt/flutter
export PUB_CACHE=$PWD/.pub_cache/
- name: 🚃 Cache pub modules
id: cache-pub-modules
uses: actions/cache@v3
env:
cache-name: cache-pub-modules
with:
key: ${{ runner.os }}-pub-${{ env.cache-name }}-${{ hashFiles('**/pubspec.lock') }}
path: |
$PWD/.pub_cache/
$PWD/.dart_tool/
$PWD/.flutter-plugins
$PWD/.flutter-plugins-dependencies
$PWD/.packages
- name: 👷 Get dependencies
run: |
flutter pub get
timeout-minutes: 5
- name: 🖼️ Move images from assets to web
working-directory: ${{ env.working-directory }}
run: |
dart run bin/web_move_images.dart
timeout-minutes: 5
- name: 🏗️ Codegen
working-directory: ${{ env.working-directory }}
run: |
dart pub global activate intl_utils
dart pub global run intl_utils:generate
flutter gen-l10n --arb-dir lib/src/common/localization --output-dir lib/src/common/localization/generated --template-arb-file intl_en.arb
dart run build_runner build --delete-conflicting-outputs --release
timeout-minutes: 5
- name: 🌐 Build flutter web
working-directory: ${{ env.working-directory }}
run: |
flutter build web --release --no-source-maps \
--no-tree-shake-icons --pwa-strategy offline-first \
--base-href / \
--dart-define-from-file=config/production.json
- name: 📁 Upload web build result
uses: actions/upload-artifact@v3
with:
name: web-live
retention-days: 1
if-no-files-found: error
path: |
example/build/web/
example/.firebaserc
example/firebase.json
firebase.json
# Deploy web on production / live channel
web-deploy:
name: "Deploy web on live channel"
timeout-minutes: 5
runs-on: ubuntu-latest
#defaults:
# run:
# working-directory: ./example
needs: build
steps:
- name: 📦 Download result for web build job
uses: actions/download-artifact@v3
with:
name: web-live
- name: 📥 List web artifact
run: |
tree
- name: 🔥 Deploy to Firebase live channel
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_FLUTTER_OCTOPUS_EXAMPLE }}"
entryPoint: example/
channelId: live
projectId: flutter-octopus-example
#target: flutter-octopus-example