-
Notifications
You must be signed in to change notification settings - Fork 1
224 lines (200 loc) · 6.51 KB
/
release.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
on:
#pull_request: #ODO: remove
push:
branches:
- staging
- release
paths:
- 'release-info.md'
name: Release
env:
working-directory: ./frontend
API_KEY: ${{secrets.API_KEY}}
API_URL: https://inspection.mbg-solutions.com/api/secure #edit this if necessary
defaults:
run:
working-directory: ./frontend #make sure it == ${{ env.working-directory}}
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Mastbau-FN/inspector/.github/actions/setup@main
- name: run tests and report coverage
run: flutter test --coverage
- name: comment coverage
if: github.event.pull_request
uses: romeovs/lcov-reporter-action@v0.2.16
with:
github-token: ${{secrets.TOKEN_GITHUB}}
build-doc:
needs: test
name: Build Docs
runs-on: ubuntu-latest
env:
API_KEY: ${{ secrets.API_KEY}}
API_URL: https://inspection.mbg-solutions.com/api/secure #edit this if necessary
steps:
- uses: actions/checkout@v2
- uses: Mastbau-FN/inspector/.github/actions/setup@main
- name: Build Documentation
run: |
flutter pub global activate dartdoc
flutter pub global run dartdoc
- name: upload doc artifact
uses: actions/upload-artifact@v2
with:
name: doc
path: ${{ env.working-directory}}/doc/api
build-app:
# needs: test
name: Build Web + Android (apk+aab)
runs-on: ubuntu-latest
strategy:
matrix:
platform: [web, apkd, apkr, appbundle]
steps:
- uses: actions/checkout@v2
- uses: Mastbau-FN/inspector/.github/actions/setup@main
- name: create key.properties for signing
run: |
cd android
touch key.properties
printf "${{ secrets.KEY_PROPERTIES }}" >> key.properties
ls
pwd
- name: map build-type (platform) to path
uses: kanga333/variable-mapper@v0.2.2
with:
key: ${{matrix.platform}}
map: |
{
"web": {
"builtpath": "build/web",
"buildcmd": "flutter build web"
},
"apkr": {
"builtpath": "build/app/outputs/flutter-apk/app-release.apk",
"buildcmd": "flutter build apk --release"
},
"apkd": {
"builtpath": "build/app/outputs/flutter-apk/app-debug.apk",
"buildcmd": "flutter build apk --debug"
},
"appbundle": {
"builtpath": "build/app/outputs/bundle/release/app-release.aab",
"buildcmd": "flutter build appbundle"
}
}
- name: Build ${{matrix.platform}}
run: ${{env.buildcmd}}
- name: upload ${{matrix.platform}} artifact
uses: actions/upload-artifact@v2
with:
name: ${{matrix.platform}}
path: ${{env.working-directory}}/${{env.builtpath}}
deploy-web:
needs: [build-doc,build-app,test]
name: Deploy Web-App and Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # no idea why but apperently this creates a folder structure (i dont need my repo to be checked out tho)
- name: download web artifact
uses: actions/download-artifact@v2
with:
name: web
path: web
- name: download doc artifact
uses: actions/download-artifact@v2
with:
name: doc
path: doc
- run: ls -a && ls -a .. && ls -a ../..
- name: make gh-pages folder for doc as well as the app
run: |
cd ..
mkdir gh-pages
mv doc gh-pages/doc
mv web gh-pages/app
cd gh-pages && touch .nojekyll
# the last command is needed to serve the .env
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: gh-pages
folder: gh-pages
release-GH:
needs: [build-app, test]
name: Release to GH
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Read release notes
id: release-info
uses: juliangruber/read-file-action@v1
with:
path: ./release-info.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release_v_${{ github.run_number }}${{ github.ref_name != 'release' && '-dev' || ' ' }}
release_name: AutoRelease (v${{ github.run_number }})
body: ${{ steps.release-info.outputs.content }}
draft: false
prerelease: false
- name: download apk
uses: actions/download-artifact@v2
with:
name: apkr
- name: upload apk
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app-release.apk
asset_name: inspector.apk
asset_content_type: application/octet-stream
- name: download debug apk
uses: actions/download-artifact@v2
with:
name: apkd
- name: upload debug apk
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app-debug.apk
asset_name: inspector-debug.apk
asset_content_type: application/octet-stream
release-playstore:
if: false #github.ref_name == 'release'
needs: [build-app,test]
name: Release to the google playstore
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # need release notes
- name: download aab
uses: actions/download-artifact@v2
with:
name: appbundle
- name: create release notes #TODO make this actual notes
run: |
cd ..
mkdir news
touch news/whatsnew-en-US
cat ./release-info.md >> news/whatsnew-en-US
- name: upload aab
uses: r0adkll/upload-google-play@v1.0.15
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: com.mbgsolutions.inspector
releaseFiles: app-release.aab
track: beta #TODO: when stable move to production
inAppUpdatePriority: 2
whatsNewDirectory: news