-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug-build.yml
71 lines (60 loc) · 1.91 KB
/
debug-build.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
name: APK Build debug
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: chmod +x
run: chmod +x ./gradlew
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Get version, commit, repo info
run: |
version=$(grep versionName app/build.gradle | awk -F\" '{print $2}')
commit=$(echo ${{ github.sha }} | cut -c-7)
repo=$(echo ${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/})
timestamp=$(date +'%Y%m%d%H%M%S')
echo "version=$version"
echo "commit=$commit"
echo "repo=$repo"
echo "timestamp=$timestamp"
echo "ZIP_NAME=${repo}-v${version}-${commit}-${timestamp}.zip" >> $GITHUB_ENV
id: version-info
- name: Build APK
run: ./gradlew assembleDebug
- name: Verify APK location
run: |
ls app/build/outputs/apk/debug/
- name: Create ZIP file with APK
run: |
if [ -f "app/build/outputs/apk/debug/app-debug.apk" ]; then
echo "APK found, creating ZIP..."
ZIP_NAME="${{ env.ZIP_NAME }}"
zip -j "$ZIP_NAME" app/build/outputs/apk/debug/app-debug.apk
else
echo "APK file not found, exiting."
exit 1
fi
- name: Upload the generated ZIP file as an artifact
uses: actions/upload-artifact@v4
with:
name: "${{ env.ZIP_NAME }}"
path: ${{ env.ZIP_NAME }}