This repository was archived by the owner on May 21, 2026. It is now read-only.
feat(CmdLogPage): 重构日志读取逻辑,优化根服务连接 #116
This file contains hidden or 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 CI | |
| on: | |
| push: | |
| branches: [ master, Alpha ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-20.04 | |
| if: ${{ startsWith(github.event.head_commit.message, '[ci]') }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| with: | |
| submodules: 'recursive' | |
| fetch-depth: 0 | |
| - name: Setup JDK 11 | |
| uses: actions/setup-java@v1 | |
| with: | |
| java-version: 11 | |
| - name: Write key | |
| if: github.event_name != 'pull_request' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' ) | |
| run: | | |
| echo storePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> local.properties | |
| echo keyAlias='${{ secrets.ALIAS }}' >> local.properties | |
| echo keyPassword='${{ secrets.ALIAS_KEY_PASSWORD }}' >> local.properties | |
| echo fileDir='../key.jks' >> local.properties | |
| echo '${{ secrets.SIGNING_KEY_BASE64 }}' | base64 --decode > key.jks | |
| - name: Cache Gradle Dependencies | |
| uses: actions/cache@v2 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| !~/.gradle/caches/build-cache-* | |
| key: gradle-deps-manager-${{ hashFiles('**/build.gradle.kts') }} | |
| restore-keys: | | |
| gradle-deps | |
| - name: Cache Gradle Build | |
| uses: actions/cache@v2 | |
| with: | |
| path: | | |
| ~/.gradle/caches/build-cache-* | |
| key: gradle-builds-manager-${{ github.sha }} | |
| restore-keys: | | |
| gradle-builds | |
| - name: Build with Gradle | |
| id: buildRelease | |
| run: | | |
| echo 'org.gradle.caching=true' >> gradle.properties | |
| echo 'org.gradle.parallel=true' >> gradle.properties | |
| echo 'org.gradle.vfs.watch=true' >> gradle.properties | |
| echo 'org.gradle.jvmargs=-Xmx2048m' >> gradle.properties | |
| ./gradlew assemble | |
| sudo apt install -y apksigner | |
| echo '${{ secrets.SIGNING_KEY_BASE64 }}' | base64 --decode > key.jks | |
| apksigner sign --ks key.jks --ks-pass 'pass:${{ secrets.KEY_STORE_PASSWORD }}' "`ls app/build/outputs/apk/release/DashBoard*-v*-release.apk`" | |
| echo "::set-output name=releaseName::`ls app/build/outputs/apk/release/DashBoard*-v*-release.apk | awk -F '(/|.apk)' '{print $6}'`" | |
| echo "::set-output name=debugName::`ls app/build/outputs/apk/debug/DashBoard*-v*-debug.apk | awk -F '(/|.apk)' '{print $6}'`" | |
| - name: Upload releaseAPK | |
| if: success() | |
| uses: actions/upload-artifact@v2 | |
| with: | |
| name: ${{ steps.buildRelease.outputs.releaseName }} | |
| path: "app/build/outputs/apk/release/*.apk" | |
| - name: Post to release channel | |
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' | |
| env: | |
| CHANNEL_ID: ${{ secrets.TELEGRAM_TO }} | |
| BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
| releaseAPK: "app/build/outputs/apk/release/${{ steps.buildRelease.outputs.releaseName }}.apk" | |
| COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
| run: | | |
| ESCAPED=`python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))'` | |
| curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://releaseAPK%22,%22caption%22:${ESCAPED}%7D%5D" -F releaseAPK="@$releaseAPK" | |
| - name: Post to release channel | |
| if: github.event_name != 'pull_request' && github.ref == 'refs/heads/Alpha' | |
| env: | |
| CHANNEL_ID: ${{ secrets.TELEGRAM_TO }} | |
| BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
| releaseAPK: "app/build/outputs/apk/release/${{ steps.buildRelease.outputs.releaseName }}.apk" | |
| COMMIT_MESSAGE: "【测试版-Alpha】\n${{ github.event.head_commit.message }}" | |
| run: | | |
| ESCAPED=`python3 -c 'import json,os,urllib.parse; print(urllib.parse.quote(json.dumps(os.environ["COMMIT_MESSAGE"])))'` | |
| curl -v "https://api.telegram.org/bot${BOT_TOKEN}/sendMediaGroup?chat_id=${CHANNEL_ID}&media=%5B%7B%22type%22:%22document%22,%20%22media%22:%22attach://releaseAPK%22,%22caption%22:${ESCAPED}%7D%5D" -F releaseAPK="@$releaseAPK" |