This repository has been archived by the owner on Jan 2, 2025. It is now read-only.
显示真实电池健康度 #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android PR Debug | |
on: | |
pull_request_target: | |
types: [ opened, synchronize] | |
paths-ignore: | |
- ".github/**" | |
- "!.github/workflows/**" | |
- ".idea/" | |
- "doc/*" | |
- "*.md" | |
- "app/src/assets/**" | |
- ".github/workflows/crowdin.yml" | |
- "crowdin.yml" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build App | |
steps: | |
- name: Checkout Git Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Set up JDK 20 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '20' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Build with Gradle | |
shell: bash | |
run: ./gradlew assembleDebug | |
- name: Find APKs | |
run: | | |
echo "APK_FILE_DEBUG=$(find app/build/outputs/apk/debug -name '*.apk')" >> $GITHUB_ENV | |
- name: Show APKs SHA256 | |
if: success() | |
run: | | |
echo "### Build Success" >> $GITHUB_STEP_SUMMARY | |
echo "|Artifact|SHA256|" >> $GITHUB_STEP_SUMMARY | |
echo "|:--------:|:----------|" >> $GITHUB_STEP_SUMMARY | |
canary=$(sha256sum "${{ env.APK_FILE_DEBUG }}") | |
echo "SHA256=$debug" >> $GITHUB_ENV | |
echo "|Debug|$debug" >> $GITHUB_STEP_SUMMARY | |
- name: Post to Debug Group | |
shell: bash | |
env: | |
GROUP_DEBUG_ID: ${{ secrets.GROUP_DEBUG_ID }} | |
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
DEBUG: ${{ env.APK_FILE_DEBUG }} | |
COMMIT_MESSAGE: |+ | |
**New PR to gitHub\!** | |
by ${{ github.triggering_actor }} | |
run: | | |
ESCAPED=$(python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))') | |
cd ${{ github.workspace }} | |
curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${GROUP_DEBUG_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://debug%22,%22parse_mode%22:%22MarkdownV2%22,%22caption%22:${ESCAPED}%7D%5D" -F debug="@${DEBUG}" |