-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (68 loc) · 2.28 KB
/
nightly-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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Nightly Build
on:
workflow_dispatch: # To run the workflow manually if needed
schedule:
- cron: '0 0 * * *' # once a day
jobs:
evaluateChanges:
name: Evaluate changes for run or skipping nightly build
runs-on: ubuntu-latest
outputs:
SHOULD_BUILD: ${{ steps.check.outputs.shouldBuild }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Check
id: check
run: |
if [[ $(git rev-list --after="24 hours" master) ]]; then
echo shouldBuild=true >> $GITHUB_OUTPUT
else
echo shouldBuild=false >> $GITHUB_OUTPUT
fi
build:
name: Generate Nightly Build
runs-on: ubuntu-latest
needs: evaluateChanges
if: ${{ needs.evaluateChanges.outputs.SHOULD_BUILD == 'true' }}
steps:
- uses: actions/checkout@v4
- name: set up JDK
uses: actions/setup-java@v4
with:
java-version: '22'
distribution: 'temurin'
cache: gradle
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Run android lint
run: ./gradlew lint
- name: Run ktlint
run: ./gradlew ktlintCheck
- name: Run detekt
run: ./gradlew detekt
- name: Run tests
run: ./gradlew test
# openssl base64 < keystore | tr -d '\n' | tee keystore.base64.txt
- name: Decode Keystore
env:
ENCODED_STRING: ${{ secrets.KEYSTORE_BASE_64 }}
run: |
echo $ENCODED_STRING > keystore-b64.txt
base64 -d keystore-b64.txt > keystore.jks
- name: Build Nightly
env:
ANDROID_NIGHTLY_KEYSTORE: ../keystore.jks
ANDROID_NIGHTLY_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_NIGHTLY_KEYSTORE_PASSWORD }}
ANDROID_NIGHTLY_KEYSTORE_ALIAS: ${{ secrets.ANDROID_NIGHTLY_KEYSTORE_ALIAS }}
run: ./gradlew assembleNightly
- name: Send apk to telegram
run: |
apk_path=$(find . -type f -iname *.apk)
curl https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendDocument \
-F chat_id=${{ secrets.TELEGRAM_CHAT_ID }} \
-F message_thread_id=15 \
-F "caption=Size: $(ls -l --block-size=K "$apk_path" | awk '{ print $5 }')" \
-F parse_mode=HTML \
-F document=@"$apk_path"