-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitlab-ci.yml
66 lines (52 loc) · 2.54 KB
/
gitlab-ci.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
image: inovex/gitlab-ci-android
stages:
- build
variables:
ANDROID_SDK_ROOT: /Library/Android/sdk
KEYSTORE_ALIAS: key0
KEYSTORE_PASSWORD: newapp
KEY_PASSWORD: newapp
APPLICATION_ID: com.medieval.numbers.battle
TELEGRAM_BOT_TOKEN: 6667949208:AAEz2A6DWM4n805sY_O6ycQ5CufDFQU04Dk
TELEGRAM_CHAT_ID: -4031862147
KEYPASS_FILE: keystore.pass
KEYSTORE_FILE: keystore.jks
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
- export ANDROID_HOME=/sdk
- export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools/33.0.1
- chmod +x ./gradlew
build:
stage: build
script:
- |
KEYSTORE_FILE=$CI_PROJECT_DIR/app/keystore.jks
if [ -f $KEYSTORE_FILE ]; then
echo "File $KEYSTORE_FILE already exists."
else
keytool -genkeypair -v -keystore $KEYSTORE_FILE -keyalg RSA -keysize 2048 -validity 10000 -alias $KEYSTORE_ALIAS -storepass $KEYSTORE_PASSWORD -keypass $KEY_PASSWORD -dname "CN=John Doe, OU=Dev, O=Company, L=City, ST=State, C=US"
echo "Created $KEYSTORE_FILE in the app directory."
fi
- ./gradlew assembleRelease
- mv app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/release/$APPLICATION_ID.apk
- ls app/build/outputs/apk/release/
- ./gradlew bundleRelease
- ls app/build/outputs/bundle/release/
- mv app/build/outputs/bundle/release/app-release.aab app/build/outputs/bundle/release/$APPLICATION_ID.aab
artifacts:
name: $APPLICATION_ID
paths:
- app/build/outputs/apk/release/$APPLICATION_ID.apk
- app/build/outputs/bundle/release/$APPLICATION_ID.aab
- app/keystore.jks
only:
- master
after_script:
- |
MESSAGE="$CI_COMMIT_MESSAGE"
curl -s -X POST https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage -d "chat_id=$TELEGRAM_CHAT_ID" -d "text=$MESSAGE"
curl -F chat_id=$TELEGRAM_CHAT_ID -F document=@app/build/outputs/bundle/release/$APPLICATION_ID.aab -F text=MESSAGE -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendDocument
curl -F chat_id=$TELEGRAM_CHAT_ID -F document=@app/keystore.jks -F text="Keystore File" -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendDocument
curl -F chat_id=$TELEGRAM_CHAT_ID -F document=@app/build/outputs/apk/release/$APPLICATION_ID.apk -F text=MESSAGE -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendDocument