-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (129 loc) · 5.37 KB
/
flutter_ci.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
name: Flutter CI/CD
on:
push:
branches:
- master
tags:
- '*'
permissions:
contents: write
jobs:
build-android:
runs-on: ubuntu-latest
steps:
- name: Checkout from GitHub
uses: actions/checkout@v4
with:
fetch-depth: 0 # for GitVersion
# cf https://github.com/GitTools/actions/blob/v0.10.2/docs/examples/github/gitversion/setup/usage-examples.md
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: "5.x"
# cf https://github.com/GitTools/actions/blob/v0.10.2/docs/examples/github/gitversion/execute/usage-examples.md#example-5
- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0
- name: Decode keystore
run: echo "${{ secrets.UPLOAD_KEYSTORE_BASE64 }}" | base64 --decode > android/app/upload-keystore.jks
- name: Create key.properties
run: |
echo "storeFile=upload-keystore.jks" > android/key.properties
echo "storePassword=${{ secrets.UPLOAD_KEYSTORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.UPLOAD_KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=upload" >> android/key.properties
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: "gradle"
- name: Check Java
run: java -version
- name: Set up Flutter actions
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:'
- name: Install dependencies
run: flutter pub get
# - name: Run tests
# run: flutter test
- name: Build APK
run: flutter build apk --build-name=${{ steps.gitversion.outputs.majorMinorPatch }}+${{ steps.gitversion.outputs.ShortSha }} --build-number=${{ github.run_number }}
# - name: Upload APK
# uses: actions/upload-artifact@v4
# with:
# name: app-release.apk
# path: build/app/outputs/flutter-apk/app-release.apk
- name: Build App Bundle
run: flutter build appbundle --build-name=${{ steps.gitversion.outputs.majorMinorPatch }}+${{ steps.gitversion.outputs.ShortSha }} --build-number=${{ github.run_number }}
# - name: Upload App Bundle
# uses: actions/upload-artifact@v4
# with:
# name: app-release.aab
# path: build/app/outputs/bundle/release/app-release.aab
# if a tag is being pushed, upload to Google Play
- name: Upload to Google Play
if: startsWith(github.ref, 'refs/tags/')
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: nbros.ong_music
releaseFiles: build/app/outputs/bundle/release/app-release.aab
track: 'alpha' # internal, alpha, beta, production
status: completed # draft, or completed(default) to release directly
build-windows:
runs-on: windows-latest
steps:
- name: Checkout from GitHub
uses: actions/checkout@v4
with:
fetch-depth: 0 # for GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: "5.x"
- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0
- name: Set up Flutter actions
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:'
- name: Install dependencies
run: flutter pub get
# - name: Run tests
# run: flutter test
- name: Build Windows app
run: flutter build windows --release --build-name=${{ steps.gitversion.outputs.majorMinorPatch }} --build-number=${{ github.run_number }}
- name: Compute zip name
id: zip-name
run: |
echo "::set-output name=basename::Ong_Music-windows-${{ steps.gitversion.outputs.majorMinorPatch }}+${{ github.run_number }}"
- name: Create Windows build zip
run: |
mkdir "${{ steps.zip-name.outputs.basename }}"
mv build/windows/x64/runner/Release/* "${{ steps.zip-name.outputs.basename }}"
Invoke-WebRequest -Uri https://github.com/tekartik/sqflite/raw/master/sqflite_common_ffi/lib/src/windows/sqlite3.dll -OutFile "${{ steps.zip-name.outputs.basename }}/sqlite3.dll"
7z a "${{ steps.zip-name.outputs.basename }}.zip" "${{ steps.zip-name.outputs.basename }}"
- name: Upload Windows app zip
uses: actions/upload-artifact@v4
with:
name: "${{ steps.zip-name.outputs.basename }}.zip"
path: "${{ steps.zip-name.outputs.basename }}.zip"
- name: Read tag message
if: startsWith(github.ref, 'refs/tags/')
run: |
git tag -l --format='%(contents)' ${{ github.ref }} > tag-message.txt
- name: Create GitHub Release and Upload Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: "${{ steps.zip-name.outputs.basename }}.zip"
body_path: tag-message.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}