Skip to content

Instantly share code, notes, and snippets.

@meyt
Created September 16, 2018 15:50
Show Gist options
  • Save meyt/a43e78301bad232bf114291fed92b433 to your computer and use it in GitHub Desktop.
Save meyt/a43e78301bad232bf114291fed92b433 to your computer and use it in GitHub Desktop.
Android CI/CD Configuration for Gitlab (docker + alpine + gradle-cache + telegram notification)
image: alvrme/alpine-android:android-28
stages:
- release
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- apk add --no-cache curl
- export GRADLE_USER_HOME=$(pwd)/.gradle
- echo "GRADLE_USER_HOME=${GRADLE_USER_HOME}"
- chmod +x ./gradlew
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/wrapper
- .gradle/caches
build:
stage: release
script:
- ./gradlew clean assembleRelease
- curl -F chat_id="${tgBotChatId}" -F document=@"./presentation/build/outputs/apk/release/presentation-release-unsigned.apk" "https://api.telegram.org/bot${tgBotKey}/sendDocument"
artifacts:
name: "$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME"
expire_in: 2 weeks
paths:
- presentation/build/outputs/apk/release/*.apk
@meyt
Copy link
Author

meyt commented Sep 16, 2018

Note: Set tgBotChatId and tgBotKey on Gitlab CI/CD Variables.

Find chat ID:

curl -i -X GET https://api.telegram.org/bot<apikey>/getUpdates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment