mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-01 06:45:19 +00:00
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:
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:
|
on:
|
||||||
schedule:
|
push:
|
||||||
- cron: '0 0 * * *'
|
branches-ignore:
|
||||||
|
- master
|
||||||
|
|
||||||
|
name: Build debug
|
||||||
jobs:
|
jobs:
|
||||||
deploy-release-snapshot:
|
generate-debug-build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
@@ -15,6 +17,9 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
|
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
|
- uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ~/.gradle/caches
|
path: ~/.gradle/caches
|
||||||
@@ -23,19 +28,15 @@ jobs:
|
|||||||
- name: Download gradle dependencies
|
- name: Download gradle dependencies
|
||||||
run: ./gradlew dependencies
|
run: ./gradlew dependencies
|
||||||
|
|
||||||
- name: Build release app
|
- name: Build debug app
|
||||||
run: ./gradlew :app:assembleRelease
|
run: ./gradlew :app:assembleDebug
|
||||||
env:
|
|
||||||
SNAPSHOT: "true"
|
|
||||||
|
|
||||||
- name: Clean secrets
|
- name: Clean secrets
|
||||||
run: release/signing-cleanup.sh
|
run: release/signing-cleanup.sh
|
||||||
|
|
||||||
- name: Deploy snapshot
|
- name: Send APK to Telegram
|
||||||
run: release/deploy-snapshot.sh
|
run: release/deploy-telegram.sh
|
||||||
env:
|
env:
|
||||||
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
TG_TO: ${{ secrets.TELEGRAM_TO }}
|
||||||
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
|
TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
SERVER_ADDRESS: ${{ secrets.SERVER_ADDRESS }}
|
TG_FILE: ./app/build/outputs/apk/debug/app-debug.apk
|
||||||
SERVER_DESTINATION: ${{ secrets.SERVER_DESTINATION }}
|
|
||||||
SSH_PORT: ${{ secrets.SSH_PORT }}
|
|
3
.github/workflows/deploy_snapshot.yml
vendored
3
.github/workflows/deploy_snapshot.yml
vendored
@@ -17,6 +17,9 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }}
|
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
|
- uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ~/.gradle/caches
|
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
|
- 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
|
- uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ~/.gradle/caches
|
path: ~/.gradle/caches
|
||||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/dependencies.gradle') }}
|
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
|
- uses: actions/upload-artifact@master
|
||||||
with:
|
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"
|
Reference in New Issue
Block a user