-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (81 loc) · 2.83 KB
/
android.yml
File metadata and controls
86 lines (81 loc) · 2.83 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
name: Android CI & Release
'on':
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: temurin
cache: gradle
- name: Create local.properties
run: |
echo "SPOTIFY_CLIENT_ID=${{ secrets.SPOTIFY_CLIENT_ID }}" >> local.properties
echo "myAccessToken=${{ secrets.SPOTIFY_ACCESS_TOKEN }}" >> local.properties
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew assembleRelease
env:
GITHUB_RUN_NUMBER: '${{ github.run_number }}'
GITHUB_REF_NAME: '${{ github.ref_name }}'
- name: Setup build tool version variable
shell: bash
run: >
BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail
-n 1)
echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
echo Last build tool version is: $BUILD_TOOL_VERSION
- name: Sign APK
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: '${{ secrets.KEYSTORE }}'
alias: '${{ secrets.KEY_ALIAS }}'
keyStorePassword: '${{ secrets.KEYSTORE_PASSWORD }}'
keyPassword: '${{ secrets.KEY_PASSWORD }}'
env:
BUILD_TOOLS_VERSION: '${{ env.BUILD_TOOL_VERSION }}'
- name: Rename and Isolate Signed APK
if: 'success() && startsWith(github.ref, ''refs/tags/'')'
shell: bash
run: |
# 1. Create a clean directory
mkdir -p final_binaries
# 2. Get the source path from the previous step's output
# Using quotes to prevent shell expansion errors
SOURCE_FILE="${{ steps.sign_app.outputs.signedReleaseFile }}"
# 3. Define the new name using the tag
NEW_NAME="LyriSync-${{ github.ref_name }}.apk"
TARGET_PATH="final_binaries/$NEW_NAME"
# 4. Move the file
if [ -f "$SOURCE_FILE" ]; then
mv "$SOURCE_FILE" "$TARGET_PATH"
echo "FINAL_APK=$TARGET_PATH" >> $GITHUB_ENV
echo "Successfully prepared: $NEW_NAME"
else
echo "Error: Source APK not found at $SOURCE_FILE"
exit 1
fi
- name: Upload to GitHub Release
if: 'startsWith(github.ref, ''refs/tags/'')'
uses: softprops/action-gh-release@v2
with:
files: '${{ env.FINAL_APK }}'
generate_release_notes: true
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'