-
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 1.92 KB
/
flutterBuildApk.yml
File metadata and controls
70 lines (60 loc) · 1.92 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: Build Debug APK (Disposable)
on:
workflow_dispatch:
jobs:
build-debug:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Inject .env file
run: |
echo "${{ secrets.ENV_FILE }}" > .env
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- name: Cache pub
uses: actions/cache@v4
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
# Xóa TẤT CẢ artifact cũ
- name: Delete ALL previous artifacts (repo-wide)
uses: actions/github-script@v7
with:
script: |
let page = 1;
let deleted = 0;
while (true) {
const res = await github.rest.actions.listArtifactsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100,
page
});
const arts = res.data.artifacts || [];
if (arts.length === 0) break;
for (const a of arts) {
await github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: a.id
});
deleted++;
core.info(`Deleted artifact: ${a.name} (id=${a.id})`);
}
page++;
}
core.info(`Total deleted artifacts: ${deleted}`);
- name: Install dependencies
run: flutter pub get
- name: Build Debug APK
run: flutter build apk --debug
- name: Upload Debug APK
uses: actions/upload-artifact@v4
with:
name: app-debug-latest
path: build/app/outputs/flutter-apk/app-debug.apk
retention-days: 7