This repository has been archived by the owner on Jun 23, 2024. It is now read-only.
forked from VN0/BlackHole
-
Notifications
You must be signed in to change notification settings - Fork 1
200 lines (166 loc) · 6.87 KB
/
flutter_beta.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: "[DEV] Build and Publish"
on:
workflow_dispatch:
push:
branches:
develop
env:
JAVA_VERSION: "12.x"
FLUTTER_CHANNEL: "stable"
#PROPERTIES_PATH: "./android/key.properties"
jobs:
build_ios:
name: "Build IOS"
runs-on: macos-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: ${{env.JAVA_VERSION}}
cache: "gradle"
# Gradle cache for faster builds
- uses: actions/[email protected]
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
# Setup the flutter environment.
- uses: subosito/[email protected]
with:
channel: ${{env.FLUTTER_CHANNEL}}
cache: true
#- run: |
# echo storePassword=${{ secrets.STORE_PASSWORD }} >> ${{env.PROPERTIES_PATH}}
# echo keyPassword=${{ secrets.KEY_PASSWORD }} >> ${{env.PROPERTIES_PATH}}
# echo keyAlias=${{ secrets.KEY_ALIAS }} >> ${{env.PROPERTIES_PATH}}
# echo storeFile=/home/runner/work/Soundal/Soundal/android/app/keystore.jks >> ${{env.PROPERTIES_PATH}}
# echo ${{ secrets.KEYSTORE }} | base64 --decode > /home/runner/work/Soundal/Soundal/android/app/keystore.jks
# Get flutter dependencies.
- run: flutter pub get
# Check for any formatting issues in the code.
#- run: dart format --set-exit-if-changed .
# Statically analyze the Dart code for any errors.
- run: flutter analyze . --no-fatal-infos --no-fatal-warnings
# Run widget tests for our flutter project.
- run: flutter test
# Build app.
- run: flutter build ios --release --no-codesign --build-number=${{ github.run_number }}
- name: Create IPA
run: |
cd build/ios/iphoneos/
mkdir Payload
mv Runner.app Payload/
zip -r Soundal_beta.ipa Payload
# Upload generated apk to the artifacts.
- uses: actions/[email protected]
with:
name: Soundal_beta.ipa
path: build/ios/iphoneos/Soundal_beta.ipa
build_android:
name: "Build Android"
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
# Setup Java environment in order to build the Android app.
- uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: ${{env.JAVA_VERSION}}
cache: "gradle"
# Gradle cache for faster builds
- uses: actions/[email protected]
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
# Setup the flutter environment.
- uses: subosito/[email protected]
with:
channel: ${{env.FLUTTER_CHANNEL}}
cache: true
#- run: |
# echo storePassword=${{ secrets.STORE_PASSWORD }} >> ${{env.PROPERTIES_PATH}}
# echo keyPassword=${{ secrets.KEY_PASSWORD }} >> ${{env.PROPERTIES_PATH}}
# echo keyAlias=${{ secrets.KEY_ALIAS }} >> ${{env.PROPERTIES_PATH}}
# echo storeFile=/home/runner/work/Soundal/Soundal/android/app/keystore.jks >> ${{env.PROPERTIES_PATH}}
# echo ${{ secrets.KEYSTORE }} | base64 --decode > /home/runner/work/Soundal/Soundal/android/app/keystore.jks
# Get flutter dependencies.
- run: flutter pub get
# Check for any formatting issues in the code.
#- run: dart format --set-exit-if-changed .
# Statically analyze the Dart code for any errors.
- run: flutter analyze . --no-fatal-infos --no-fatal-warnings
# Run widget tests for our flutter project.
- run: flutter test
# Build apk.
- run: flutter build apk --release --build-number=${{ github.run_number }}
- name: Rename file
run: mv build/app/outputs/apk/release/app-release.apk build/app/outputs/apk/release/Soundal_beta.apk
# Upload generated apk to the artifacts.
- uses: actions/[email protected]
with:
name: Soundal_beta.apk
path: build/app/outputs/apk/release/Soundal_beta.apk
release:
name: "Publish"
runs-on: ubuntu-latest
needs: [build_android, build_ios]
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
path: artifacts
- name: Get version
id: yq
uses: mikefarah/yq@master
with:
cmd: yq -r '.version' 'pubspec.yaml'
- uses: bhowell2/[email protected]
id: version
with:
value: ${{ steps.yq.outputs.result }}
length_from_start: 5
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "Soundal-v${{ steps.version.outputs.substring }}-beta${{ github.run_number }}"
prerelease: true
title: "Soundal-v${{ steps.version.outputs.substring }}-beta${{ github.run_number }}"
files: |
LICENSE
./artifacts/Soundal_beta.apk
./artifacts/Soundal_beta.ipa
#- uses: actions/upload-artifact@v2
# with:
# name: app-armeabi-v7a-release.apk
# path: build/app/outputs/apk/release/app-armeabi-v7a-release.apk
# - name: Commit on Telegram
# uses: appleboy/telegram-action@master
# with:
# to: ${{ secrets.TELEGRAM_CHAT_ID }}
# token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
# format: markdown
# disable_web_page_preview: true
# message: |
# New commit pushed to [${{ github.event.repository.name }}](${{ github.event.repository.html_url }}) by [${{ github.event.head_commit.author.name }}](${{ github.event.head_commit.author.html_url }}).
# Commit message: ${{ github.event.head_commit.message }}
# document: build/app/outputs/apk/release/app-arm64-v8a-release.apk, build/app/outputs/apk/release/app-armeabi-v7a-release.apk
# - name: Report failure on Telegram
# uses: appleboy/telegram-action@master
# if: ${{ failure() }}
# with:
# to: ${{ secrets.TELEGRAM_CHAT_ID }}
# token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
# format: markdown
# disable_web_page_preview: true
# message: |
# Build Failed!! @Sangwan5688
# Commit was pushed to [${{ github.event.repository.name }}](${{ github.event.repository.html_url }}) by [${{ github.event.head_commit.author.name }}](${{ github.event.head_commit.author.html_url }}).
# Commit message: ${{ github.event.head_commit.message }}