Skip to content

search in Package selector #48

search in Package selector

search in Package selector #48

Workflow file for this run

name: Build APK
on:
push:
paths-ignore:
- '**.md'
tags-ignore:
- '**'
branches-ignore:
- 'master'
jobs:
build:
name: Build CI
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '21'
- name: Get short commit SHA
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Build APK (testkey)
run: ./gradlew build
- name: Upload Debug APK (testkey)
uses: actions/upload-artifact@v4
with:
name: OwnDroid-CI-${{ env.SHORT_SHA }}-debug-testkey
path: app/build/outputs/apk/debug/app-debug.apk
- name: Upload Release APK (testkey)
uses: actions/upload-artifact@v4
with:
name: OwnDroid-CI-${{ env.SHORT_SHA }}-release-testkey
path: app/build/outputs/apk/release/app-release.apk
- name: Export key
env:
KEY_BASE64: ${{ secrets.KEY_BASE64 }}
run: echo "$KEY_BASE64" | base64 --decode - > app/signature.jks
- name: Build APK
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
run: ./gradlew build
- name: Upload Debug APK
uses: actions/upload-artifact@v4
with:
name: OwnDroid-CI-${{ env.SHORT_SHA }}-debug-signed
path: app/build/outputs/apk/debug/app-debug.apk
- name: Upload Release APK
uses: actions/upload-artifact@v4
with:
name: OwnDroid-CI-${{ env.SHORT_SHA }}-release-signed
path: app/build/outputs/apk/release/app-release.apk
upload-telegram:
name: Upload Builds
if: ${{ success() }}
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Download telegram-bot-api-binary
run: |
mkdir ./binaries
wget "https://github.com/jakbin/telegram-bot-api-binary/releases/download/latest/telegram-bot-api" -O ./binaries/telegram-bot-api
chmod +x ./binaries/telegram-bot-api
- name: Start API Server & Upload
env:
COMMIT_MESSAGE: |+
New push to GitHub\!
```
${{ github.event.head_commit.message }}
```by `${{ github.event.head_commit.author.name }}`
See commit detail [here](${{ github.event.head_commit.url }})
COMMIT_URL: ${{ github.event.head_commit.url }}
run: |
ESCAPED=`python3 -c 'import json,os,urllib.parse; msg = json.dumps(os.environ["COMMIT_MESSAGE"]); print(urllib.parse.quote(msg if len(msg) <= 1024 else json.dumps(os.environ["COMMIT_URL"])))'`
cd artifacts
export DEBUG_TEST_PWD=$(find . -name "*-debug-testkey*")
mv ./$DEBUG_TEST_PWD/app-debug.apk ./$DEBUG_TEST_PWD.apk && rm -rf ./$DEBUG_TEST_PWD
export RELEASE_TEST_PWD=$(find . -name "*release-testkey*")
mv ./$RELEASE_TEST_PWD/app-release.apk ./$RELEASE_TEST_PWD.apk && rm -rf ./$RELEASE_TEST_PWD
export DEBUG_SIGNED_PWD=$(find . -name "*-debug-signed*")
mv ./$DEBUG_SIGNED_PWD/app-debug.apk ./$DEBUG_SIGNED_PWD.apk && rm -rf ./$DEBUG_SIGNED_PWD
export RELEASE_SIGNED_PWD=$(find . -name "*release-signed*")
mv ./$RELEASE_SIGNED_PWD/app-release.apk ./$RELEASE_SIGNED_PWD.apk && rm -rf ./$RELEASE_SIGNED_PWD
../binaries/telegram-bot-api --api-id=${{ secrets.TELEGRAM_API_APP_ID }} --api-hash=${{ secrets.TELEGRAM_API_HASH }} --local 2>&1 > /dev/null &
export token=${{ secrets.TELEGRAM_BOT_KEY }}
curl -v "http://127.0.0.1:8081/bot$token/sendMediaGroup?chat_id=-1002216379163&media=%5B%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FdebugTest%22%7D%2C%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseTest%22%7D%2C%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FdebugSigned%22%7D%2C%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseSigned%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22%3A${ESCAPED}%7D%5D" \
-F debugTest="@$DEBUG_TEST_PWD.apk" \
-F releaseTest="@$RELEASE_TEST_PWD.apk" \
-F debugSigned="@$DEBUG_SIGNED_PWD.apk" \
-F releaseSigned="@$RELEASE_SIGNED_PWD.apk"