-
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (73 loc) · 2.24 KB
/
build.yml
File metadata and controls
86 lines (73 loc) · 2.24 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Build
on:
push:
paths:
- ".github/workflows/build.yml"
- "android/**"
- "lib/**"
- "pubspec.yaml"
branches:
- main
pull_request:
paths:
- ".github/workflows/build.yml"
- "android/**"
- "lib/**"
- "pubspec.yaml"
branches:
- main
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: "gradle"
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Cache Android SDK components
uses: actions/cache@v4
with:
path: |
$ANDROID_HOME/platforms
$ANDROID_HOME/build-tools
$ANDROID_HOME/ndk
$ANDROID_HOME/cmake
key: ${{ runner.os }}-android-sdk-${{ hashFiles('**/build.gradle') }}
restore-keys: |
${{ runner.os }}-android-sdk-
- name: Install Android SDK, NDK, and CMake
run: |
export ANDROID_SDK_ROOT=$ANDROID_HOME
export PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools:$PATH
yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install \
"platforms;android-33" \
"build-tools;33.0.2" \
"ndk;27.0.12077973" \
"cmake;3.22.1"
- name: Install Flutter dependencies
run: flutter pub get
- name: Create .env file
run: |
cat <<EOF > .env
GITHUBTOKEN=${{ secrets.GITHUBTOKEN }}
EOF
- name: Build APK (Release)
run: flutter build apk --release
- name: Upload to Telegram
run: |
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument" \
-F chat_id=${{ secrets.TELEGRAM_CHAT_ID }} \
-F document=@build/app/outputs/flutter-apk/app-release.apk \
-F caption="New release from GitHub Actions"