-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (56 loc) · 2.15 KB
/
build-release.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
name: Build Release
on:
workflow_dispatch:
inputs:
beta:
type: boolean
description: Is beta?
draft:
type: boolean
description: Is draft?
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup JDK 17
uses: actions/setup-java@v2
with:
java-version: 17
distribution: 'temurin'
cache: 'gradle'
- name: Setup Android SDK
uses: android-actions/[email protected]
- name: Extract Version Name
id: extract_version
run: |
versionName=$(grep '^ *versionName' app/build.gradle.kts | sed -E 's/^ *versionName *= *"([^"]+)".*/\1/')
echo "VERSION_NAME=${versionName}" >> $GITHUB_ENV
- name: Set Version
uses: chkfung/[email protected]
with:
gradlePath: app/build.gradle.kts
versionCode: ${{ env.VERSION_NAME }}
versionName: ${{ env.VERSION_NAME }}
- name: Build Signed APK
run: |
echo "${{ secrets.keystore }}" | base64 -d > $GITHUB_WORKSPACE/signing-key.jks
chmod +x ./gradlew
./gradlew packageReleaseUniversalApk -Pandroid.injected.signing.store.file=$GITHUB_WORKSPACE/signing-key.jks -Pandroid.injected.signing.store.password=${{ secrets.keystore_password }} -Pandroid.injected.signing.key.alias=${{ secrets.key_alias }} -Pandroid.injected.signing.key.password=${{ secrets.key_password }}
- name: Release
run: |
mv app/build/outputs/apk_from_bundle/release/app-release-universal.apk ./Manager.apk
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
tag="${{ env.VERSION_NAME }}"
git tag "$tag"
git push origin "$tag"
gh release create "$tag" \
--title "${{ env.VERSION_NAME }}" \
--generate-notes \
./Manager.apk \
--prerelease=${{ github.event.inputs.beta }} \
--draft=${{ github.event.inputs.draft }}
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'