name: Debug build on: push: branches: - dev paths-ignore: - '**.md' - '.github/**' - '!.github/workflows/debug.yml' jobs: build: name: Gradle Build runs-on: ubuntu-latest env: CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" CCACHE_NOHASHDIR: "true" CCACHE_MAXSIZE: "5G" CCACHE_HARDLINK: "true" steps: - name: Checkout uses: actions/checkout@v7 with: submodules: 'recursive' - name: Set up JDK 17 uses: actions/setup-java@v6 with: java-version: '17' distribution: 'temurin' - name: Setup Android SDK Tools uses: android-actions/setup-android@v4 with: packages: 'platform-tools' - name: Set up ccache uses: hendrikmuhs/ccache-action@v1 with: append-timestamp: false key: native-${{ github.job }} max-size: 5G - name: Install NDK run: | echo "y" | sdkmanager --install "ndk;27.2.12479018" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null echo "sdk.dir=${ANDROID_HOME}" > local.properties echo "ndk.dir=${ANDROID_HOME}/ndk/27.2.12479018" >> local.properties - name: Configure Gradle run: | sed -i "s/2000000000000/$(date +%s%N | cut -c1-13)/g" gradle.properties echo "sdk.dir=${ANDROID_HOME}" >> local.properties - name: Setup Gradle uses: gradle/actions/setup-gradle@v6 with: cache-read-only: false - name: Debug Build run: | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" export SENTRY_AUTH_TOKEN="${{ secrets.SENTRY_AUTH_TOKEN }}" ./gradlew TMessagesProj:assembleRelease --build-cache --no-configuration-cache APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk') APK=$(dirname $APK) echo "APK=$APK" >> $GITHUB_ENV - name: Upload gradle.properties uses: actions/upload-artifact@v7 with: name: gradle-properties path: gradle.properties - uses: actions/upload-artifact@v7 with: name: Release path: ${{ env.APK }} upload: name: Upload debug if: github.event.inputs.upload != 'y' # The channel-publish action runs a Bot API server built on this system. runs-on: ubuntu-24.04 needs: - build steps: - name: Checkout uses: actions/checkout@v7 - name: Remove gradle.properties run: | rm -f gradle.properties - name: Download gradle.properties uses: actions/download-artifact@v8 with: name: gradle-properties path: . - name: Donwload Artifacts uses: actions/download-artifact@v8 with: path: artifacts - name: Set up Python uses: actions/setup-python@v7 with: python-version: 3.12 - name: Prepare channel post id: post env: BOT_TOKEN: ${{ secrets.NAGRAM_CHANNEL_BOT_TOKEN }} CHAT_ID: ${{ vars.NAGRAM_CHANNEL_ASSETS_CHAT_ID }} COMMITS: ${{ toJSON(github.event.commits) }} run: | if [ -z "$BOT_TOKEN" ] || [ -z "$CHAT_ID" ]; then echo "::notice::NAGRAM_CHANNEL_BOT_TOKEN or NAGRAM_CHANNEL_ASSETS_CHAT_ID is not set, nothing is posted to the channel." exit 0 fi mkdir "$RUNNER_TEMP/channel" find artifacts \( -name '*arm64-v8a.apk' -o -name '*armeabi-v7a.apk' \) \ -exec cp {} "$RUNNER_TEMP/channel/" \; ls -l "$RUNNER_TEMP/channel" python bin/scripts/apk_version.py "$RUNNER_TEMP"/channel/*arm64-v8a.apk > "$RUNNER_TEMP/apk-version" cat "$RUNNER_TEMP/apk-version" >> "$GITHUB_OUTPUT" # The commits of the push, shown grouped by their kind. printf '%s\n' "$COMMITS" > "$RUNNER_TEMP/channel-commits.json" echo "chat=$CHAT_ID" >> "$GITHUB_OUTPUT" # The in-app updater reads the APKs and their JSON from the metadata # channel, whatever is posted to the channels below. - name: Update metadata env: HELPER_BOT_TOKEN: ${{ secrets.HELPER_BOT_TOKEN }} run: | python -m pip install -r bin/scripts/requirements.txt python bin/scripts/upload.py "$HELPER_BOT_TOKEN" - name: Post to channel if: steps.post.outputs.chat != '' uses: NextAlone/NagramActionRelated/channel-publish@f6be16850f0f7eddbc0fa3db6561bd3abde0a8ea with: bot-token: ${{ secrets.NAGRAM_CHANNEL_BOT_TOKEN }} api-id: ${{ secrets.NAGRAM_API_ID }} api-hash: ${{ secrets.NAGRAM_API_HASH }} chat-id: ${{ steps.post.outputs.chat }} directory: ${{ runner.temp }}/channel kind: test title: Nagram version: ${{ steps.post.outputs.version }} build: ${{ steps.post.outputs.build }} hashtags: android test commits-file: ${{ runner.temp }}/channel-commits.json files: | *arm64-v8a.apk | arm64-v8a · 大多数设备 *armeabi-v7a.apk | armeabi-v7a · 旧设备 buttons: success:Commit=${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} | danger:问题反馈=https://t.me/OrIssuesBot