forked from daohoangson/flutter_widget_from_html
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (94 loc) · 3.68 KB
/
demo_app.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
name: Demo
on:
push:
jobs:
build:
defaults:
run:
working-directory: demo_app
environment:
name: vercel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Setup Flutter
uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # v2.10.0
with:
cache: true
- name: Gradle cache
uses: gradle/gradle-build-action@ef76a971e2fa3f867b617efd72f2fbd72cf6f8bc # v2.8.0
- name: Run flutter build apk --debug
run: |
set -e
export JAVA_HOME=$JAVA_HOME_17_X64
flutter build apk --debug
- name: Upload debug APK
id: appetize
run: |
set -e
curl --http1.1 -v https://${{ secrets.APPETIZE_API_TOKEN }}@api.appetize.io/v1/apps \
-F file=@build/app/outputs/apk/debug/app-debug.apk \
-F platform=android \
-F note=${{ github.sha }} \
| tee build/appetize.json
# An extra `echo` to force new line
# otherwise GitHub won't be able to pick up the `set-output` command
echo
_url=$( cat build/appetize.json | jq -r .publicURL )
echo "url=${_url}" >> $GITHUB_OUTPUT
- run: flutter build web
- name: Generate supported/tags.html
run: |
set -e
( cd ./test/goldens && php tags.php >tags.html )
cp -R ./test/goldens build/web/supported
- name: Run flutter build apk --release
run: |
set -e
export JAVA_HOME=$JAVA_HOME_17_X64
flutter build apk --release --split-per-abi
- name: Copy APKs
run: cp -R build/app/outputs/apk/release build/web/apks
- name: Deploy via Vercel
id: now
env:
PROJECT_JSON: ${{ secrets.EXAMPLE_PROJECT_JSON }}
TOKEN: ${{ secrets.ZEIT_TOKEN }}
if: env.PROJECT_JSON != null && env.TOKEN != null
run: |
set -e
cd ./build/web
{ \
echo '{'; \
echo ' "version": 2,'; \
echo ' "builds": ['; \
echo ' { "src": "./**/*", "use": "@now/static" }'; \
echo ' ]'; \
echo '}'; \
} > ./now.json
mkdir -p ./.now && echo "$PROJECT_JSON" > ./.now/project.json
if [ $GITHUB_REF == 'refs/heads/master' ]; then
_url=$( now --prod --token "$TOKEN" )
else
_url=$( now --token "$TOKEN" )
fi
echo "url=${_url}" >> $GITHUB_OUTPUT
- name: Create commit comment
if: steps.now.conclusion == 'success'
uses: daohoangson/comment-on-github@35b21121fdbadf807678bec8210cdd7f22a934fe # v2.2.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
${{ github.sha }} APKs:
- [app-armeabi-v7a-release.apk](${{ steps.now.outputs.url }}/apks/app-armeabi-v7a-release.apk)
- [app-arm64-v8a-release.apk](${{ steps.now.outputs.url }}/apks/app-arm64-v8a-release.apk)
- [app-x86_64-release.apk](${{ steps.now.outputs.url }}/apks/app-x86_64-release.apk)
- [Debug APK](${{ steps.appetize.outputs.url }}) via https://appetize.io
Web build has been deployed to ${{ steps.now.outputs.url }}. Quick links:
- [supported/tags.html](${{ steps.now.outputs.url }}/supported/tags.html)
- [Hello World](${{ steps.now.outputs.url }}/#/helloworld)
- [Hello World (core)](${{ steps.now.outputs.url }}/#/helloworldcore)
- [Wordpress](${{ steps.now.outputs.url }}/#/wordpress)
fingerprint: "## Demo app"
replace: please