-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (70 loc) · 2.33 KB
/
release_mobile.yaml
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
name: Publish APK
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build and publish apk
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.16.9'
channel: 'stable'
- name: Set flutter version
uses: jacobtomlinson/gha-find-replace@master
with:
find: "version: 1\\.0\\.0\\+1"
replace: "version: 2.5.${{ github.run_number }}"
include: "pubspec.yaml"
- name: Replace package Paid
uses: jacobtomlinson/gha-find-replace@master
with:
find: "applicationId \".+\""
replace: "applicationId \"com.altlimit.applauncherplus\""
include: "android/app/build.gradle"
- name: Prepare mobile signing
run: |
flutter pub get
echo "${{ secrets.KEY_FILE }}" | base64 --decode > android/app/altlimit
echo -e "${{ secrets.KEY_PROPERTIES }}" >> android/key.properties
- name: Build mobile
run: |
flutter build apk --split-per-abi
- name: Prepare builds
run: |
mv build/app/outputs/flutter-apk build/apks
- uses: actions/setup-node@v2
with:
node-version: 14
- name: Upload to Release Page
uses: actions/github-script@v4
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs').promises;
const { repo: { owner, repo }, sha, runNumber } = context;
const tag_name = 'v2.5.' + runNumber;
const release = await github.repos.createRelease({
owner, repo, tag_name,
name: 'Mobile ' + tag_name,
draft: false,
target_commitish: sha
});
for (let file of await fs.readdir('./build/apks')) {
if (file.indexOf('.apk') !== -1)
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: release.data.id,
name: file,
data: await fs.readFile(`./build/apks/${file}`)
});
}