-
Notifications
You must be signed in to change notification settings - Fork 8
61 lines (58 loc) · 2.65 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
name: Build release
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Download keystore
run: curl -L -o "${GITHUB_WORKSPACE}/app/signing.keystore" "${{ secrets.keystoreURL}}"
- name: Cache Gradle downloads
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
env:
KEYSTORE: signing.keystore
KEY_ALIAS: release
KEY_PASSWORD: ${{ secrets.keystorePassword }}
KEYSTORE_PASSWORD: ${{ secrets.keystorePassword }}
run: ./gradlew assembleRelease --refresh-dependencies
- name: Find aapt binary
run: echo "AAPT_BINARY=$(ls -1 ${ANDROID_HOME}/build-tools/*/aapt | tail -n 1)" >> $GITHUB_ENV
- name: Extract release name
run: echo "APK_VERSION_NAME=$(${AAPT_BINARY} dump badging app/build/outputs/apk/release/app-release.apk | tr "\n" " " | sed -e "s/.*versionName='\([^']\+\)'.*/\1/")" >> $GITHUB_ENV
- name: Extract release code
run: echo "APK_VERSION_CODE=$(${AAPT_BINARY} dump badging app/build/outputs/apk/release/app-release.apk | tr "\n" " " | sed -e "s/.*versionCode='\([^']\+\)'.*/\1/")" >> $GITHUB_ENV
- name: Create release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.APK_VERSION_CODE }}
release_name: ${{ env.APK_VERSION_NAME }}
body: Automatically generated due to a new version of the codebase.
- name: Upload release APK
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: app/build/outputs/apk/release/app-release.apk
asset_name: app-release.apk
asset_content_type: application/vnd.android.package-archive