This repository was archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (57 loc) · 1.89 KB
/
main.yml
File metadata and controls
70 lines (57 loc) · 1.89 KB
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
name: Release Build
on:
push:
tags:
- '*'
workflow_dispatch:
env:
APK_BUILD_DIR: "/tmp/build"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v3
- name: Setup Java to compile Android project
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Get version from pubspec.yaml
id: get_version
run: |
VERSION=$(sed -n 's/^version: \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' pubspec.yaml)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Copy files to env.APK_BUILD_DIR
run: |
mkdir -p $APK_BUILD_DIR
cp -r . $APK_BUILD_DIR
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Flutter version
run: |
flutter config --no-analytics
flutter --version
- name: Decode key.properties file
working-directory: ${{ env.APK_BUILD_DIR }}
env:
ENCODED_STRING: ${{ secrets.ANDROID_KEY_PROPERTIES }}
run: echo $ENCODED_STRING | base64 -di > android/key.properties
- name: Decode android-keystore.jks file
working-directory: ${{ env.APK_BUILD_DIR }}
env:
ENCODED_STRING: ${{ secrets.KEY_JKS }}
run: echo $ENCODED_STRING | base64 -di > android/key.jks
- name: Dependencies
working-directory: ${{ env.APK_BUILD_DIR }}
run: flutter pub get
- name: Build APK
working-directory: ${{ env.APK_BUILD_DIR }}
run: flutter build apk --release
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: release-apk
path: ${{ env.APK_BUILD_DIR }}/build/app/outputs/flutter-apk/app-release.apk