-
Notifications
You must be signed in to change notification settings - Fork 17
executable file
·120 lines (108 loc) · 3.47 KB
/
android.yml
File metadata and controls
executable file
·120 lines (108 loc) · 3.47 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Android CI
on:
workflow_dispatch:
inputs:
UPAPK:
description: 'Release APK'
type: boolean
default: true
UPTG:
description: 'Send Telegram'
type: boolean
default: true
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions: write-all
env:
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
CHAT_ID: ${{ secrets.CHAT_ID }}
TG_TOKEN: ${{ secrets.TG_TOKEN }}
UPAPK: ${{ inputs.UPAPK }}
UPTG: ${{ inputs.UPTG }}
jobs:
build-release:
if: ${{ github.repository_owner == 'Zenlua' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-cache-release
- name: Build APK
run: |
chmod +x ./gradlew ./.github/modun.sh
./.github/modun.sh
chmod +x ./gradlew
./gradlew assembleRelease --daemon -x lint -x test
VER=$(grep -m1 'versionName ' pio/build.gradle | cut -d'"' -f2)
echo "Tool-Tree $VER"
echo "VER=$VER" >> $GITHUB_ENV
mkdir -p Up
cp -rf pio/build/outputs/apk/*/*.apk "Up/Tool-Tree.$VER.apk"
ls Up
echo -e "- \n- See version notes: [Changelog](https://zenlua.github.io/Tool-Tree/Version.html)" > change.txt
if [ "$UPTG" == "true" ];then
echo "Telegram"
chat_tg="https://github.com/Zenlua/Tool-Tree/releases
🎉 Release new version Tool-Tree
• Notes: <a href=\"https://zenlua.github.io/Tool-Tree/Version.html\">Changelog</a>
• Version: $VER"
# tooltree
curl -s -X POST "https://api.telegram.org/bot$TG_TOKEN/sendMessage" \
-d chat_id="$CHAT_ID" -d parse_mode="HTML" \
--data-urlencode text="$chat_tg"
fi
- name: Beta APK
uses: softprops/action-gh-release@v2
with:
name: "Tool-Tree ${{ env.VER }} Beta"
tag_name: "beta"
files: Up/*
prerelease: true
- name: Release APK
if: ${{ github.event_name == 'workflow_dispatch' && inputs.UPAPK == true }}
uses: softprops/action-gh-release@v2
with:
name: "Tool-Tree ${{ env.VER }}"
tag_name: "V${{ env.VER }}"
files: Up/*
prerelease: false
body_path: "change.txt"
build-debug:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-cache-debug
- name: Build APK
run: |
chmod +x ./gradlew ./.github/modun.sh
./.github/modun.sh
./gradlew assembleDebug --no-daemon -x lint -x test
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: debug-apk
path: pio/build/outputs/apk/*/*.apk