Skip to content

Nightly Build

Nightly Build #103

Workflow file for this run

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"