-
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (78 loc) · 2.76 KB
/
build_and_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
name: Flutter Build and Release
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
jobs:
build_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24.3'
channel: 'stable'
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache Pub dependencies
uses: actions/cache@v3
with:
path: ${{ env.FLUTTER_HOME }}/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Get dependencies
run: flutter pub get
- name: Build APK
run: flutter build apk --release --split-per-abi
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
tag_name: v0.${{ github.run_number }}
release_name: Release 0.${{ github.run_number }}
draft: false
prerelease: ${{ github.ref == 'refs/heads/dev' }}
- name: Upload armeabi-v7a APK
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
asset_name: freelexity-v0.${{ github.run_number }}-armeabi-v7a.apk
asset_content_type: application/vnd.android.package-archive
- name: Upload arm64-v8a APK
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
asset_name: freelexity-v0.${{ github.run_number }}-arm64-v8a.apk
asset_content_type: application/vnd.android.package-archive
- name: Upload x86_64 APK
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/app/outputs/flutter-apk/app-x86_64-release.apk
asset_name: freelexity-v0.${{ github.run_number }}-x86_64.apk
asset_content_type: application/vnd.android.package-archive