CI workflow improvements (#642)
* github: Only run debug tasks in PRs * github: Remove nightly deploys * github: Setup automatic debug branch deployment * Tweak Gradle config in CI Signed-off-by: Harsh Shandilya <me@msfjarvis.dev> Co-authored-by: Aditya Wasan <adityawasan55@gmail.com>
This commit is contained in:
parent
97ee48dd25
commit
bea3cd5457
5 changed files with 42 additions and 16 deletions
6
.github/ci-gradle.properties
vendored
Normal file
6
.github/ci-gradle.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
org.gradle.daemon=true
|
||||
org.gradle.configureondemand=true
|
||||
android.enableBuildCache=true
|
||||
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
|
@ -1,11 +1,13 @@
|
|||
name: "Release nightly snapshots"
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
push:
|
||||
branches-ignore:
|
||||
- master
|
||||
|
||||
name: Build debug
|
||||
jobs:
|
||||
deploy-release-snapshot:
|
||||
generate-debug-build:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v1
|
||||
|
@ -15,6 +17,9 @@ jobs:
|
|||
env:
|
||||
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
|
||||
|
||||
- name: Copy CI gradle.properties
|
||||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
|
||||
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
|
@ -23,19 +28,15 @@ jobs:
|
|||
- name: Download gradle dependencies
|
||||
run: ./gradlew dependencies
|
||||
|
||||
- name: Build release app
|
||||
run: ./gradlew :app:assembleRelease
|
||||
env:
|
||||
SNAPSHOT: "true"
|
||||
- name: Build debug app
|
||||
run: ./gradlew :app:assembleDebug
|
||||
|
||||
- name: Clean secrets
|
||||
run: release/signing-cleanup.sh
|
||||
|
||||
- name: Deploy snapshot
|
||||
run: release/deploy-snapshot.sh
|
||||
- name: Send APK to Telegram
|
||||
run: release/deploy-telegram.sh
|
||||
env:
|
||||
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
|
||||
SERVER_ADDRESS: ${{ secrets.SERVER_ADDRESS }}
|
||||
SERVER_DESTINATION: ${{ secrets.SERVER_DESTINATION }}
|
||||
SSH_PORT: ${{ secrets.SSH_PORT }}
|
||||
TG_TO: ${{ secrets.TELEGRAM_TO }}
|
||||
TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||
TG_FILE: ./app/build/outputs/apk/debug/app-debug.apk
|
3
.github/workflows/deploy_snapshot.yml
vendored
3
.github/workflows/deploy_snapshot.yml
vendored
|
@ -17,6 +17,9 @@ jobs:
|
|||
env:
|
||||
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
|
||||
|
||||
- name: Copy CI gradle.properties
|
||||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
|
||||
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
|
|
5
.github/workflows/pull_request.yml
vendored
5
.github/workflows/pull_request.yml
vendored
|
@ -8,12 +8,15 @@ jobs:
|
|||
|
||||
- uses: actions/checkout@master
|
||||
|
||||
- name: Copy CI gradle.properties
|
||||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
|
||||
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.gradle/caches
|
||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/dependencies.gradle') }}
|
||||
|
||||
- run: ./gradlew spotlessCheck build test lintDebug -Dpre-dex=false
|
||||
- run: ./gradlew spotlessCheck assembleDebug testDebug lintDebug -Dpre-dex=false
|
||||
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
|
|
13
release/deploy-telegram.sh
Executable file
13
release/deploy-telegram.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function send_to_tg() {
|
||||
local FILE
|
||||
local CHAT_ID
|
||||
local CAPTION
|
||||
FILE="${1}"
|
||||
CHAT_ID="${2}"
|
||||
CAPTION="${3}"
|
||||
curl -F chat_id="${CHAT_ID}" -F document="@${FILE}" -F caption="${CAPTION}" -F parse_mode="Markdown" "https://api.telegram.org/bot${TG_TOKEN:?}/sendDocument" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
send_to_tg "${TG_FILE:?}" "${TG_TO:?}" "aps-${GITHUB_RUN_NUMBER}-debug"
|
Loading…
Reference in a new issue