-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (74 loc) · 2.4 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
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
name: Android, iOS, Web Build
on:
push:
branches:
- master
jobs:
build:
name: Android, iOS, Web Build
env:
my_repo: "sabikrahat/github_workflow_flutter_project.git"
my_secret: "${{secrets.WORKFLOW_TOKEN}}"
my_email: "[email protected]"
my_name: "Md. Sabik Alam Rahat"
my_tag: "v1.0.${{github.run_number}}"
# This job will run on macos virtual machine
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- run: |
echo "Your Repo is $my_repo"
echo "Your secrect token is $my_secret"
echo "Your email is $my_email"
echo "Your name is $my_name"
# Setup Java environment.
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "18.x"
# Setup the flutter environment.
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: "3.3.2"
- run: flutter config --enable-android
- run: flutter config --enable-ios
- run: flutter config --enable-web
- run: flutter clean
- run: flutter pub get
# Flutter android apk build command.
- run: flutter build apk
- run: flutter build apk --split-per-abi
- run: flutter build appbundle
# Flutter ios ipa build command.
- run: |
flutter build ios --no-codesign
cd build/ios/iphoneos
mkdir Payload
cd Payload
ln -s ../Runner.app
cd ..
zip -r app.ipa Payload
# Flutter web release command.
- run: flutter build web --web-renderer html --release
- run: |
cd build/web
git init
git config --global user.email "$my_email"
git config --global user.name "$my_name"
git status
git remote add origin https://"$my_secret"@github.com/"$my_repo"
git checkout -b gh-pages
git add --all
git commit -m "update"
git push origin gh-pages -f
# Upload assets to release
- name: Push to Release
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/flutter-apk/*,build/ios/iphoneos/app.ipa,build/app/outputs/bundle/release/app-release.aab"
tag: ${{env.my_tag}}
token: ${{env.my_secret}}