-
Notifications
You must be signed in to change notification settings - Fork 40
106 lines (89 loc) · 2.8 KB
/
android.yml
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
name: Android CI
on:
push:
branches:
- master
- dev
tags:
- 'v*'
pull_request:
branches:
- master
- dev
jobs:
build:
name: Build Apk
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup JDK
uses: actions/setup-java@v3
with:
java-version: '14'
distribution: 'adopt'
cache: gradle
- name: Build Apk with Gradle
id: build
run: |
pwd
echo -e "\n\n gradlew assembleRelease start... \n\n"
chmod a+x gradlew
./gradlew assembleRelease
echo -e "\n\n Rename the Apk \n"
cd ./build/app/outputs/apk/release/
mv EbookReader_*.apk EbookReader.apk
ls -l
- name: Get Time
id: time
uses: JantHsueh/get-time-action@master
with:
timeZone: 8
- name: Get Git Log
id: git_log
uses: JantHsueh/get-git-log-action@master
with:
tag: last_release
- name: Upload Apk
uses: actions/upload-artifact@v3
if: always()
with:
name: EbookReader
path: ${{ github.workspace }}/build/app/outputs/apk/release/*.apk
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v5
- name: Print branch
run: |
echo -e "\n Running on default: ${{ steps.branch-name.outputs.current_branch }}"
- name: Get Apk Info
id: apkInfo
uses: JantHsueh/get-apk-info-action@master
with:
apkPath: ${{ github.workspace }}/build/app/outputs/apk/release/EbookReader.apk
- name: Print Apk Info
run: |
echo -e "\n Apk Info: "
echo -e "${{ steps.apkInfo.outputs.versionNum }} ${{ steps.apkInfo.outputs.versionCode }}"
- name: Print Log
run: |
echo -e "\n Log: \n"
echo -e "${{ steps.git_log.outputs.log }}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.run_number }}
release_name: ${{ github.event.repository.name }} ${{ steps.branch-name.outputs.current_branch }} v${{ steps.apkInfo.outputs.versionNum }} ${{ steps.apkInfo.outputs.versionCode }} at ${{ steps.time.outputs.time}}
- name: Upload Release APK
id: upload_release_asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/app/outputs/apk/release/EbookReader.apk
asset_name: ${{ github.event.repository.name }}_${{ steps.branch-name.outputs.current_branch }}_v${{ steps.apkInfo.outputs.versionNum }}.apk
asset_content_type: application/zip