chore(deps): update all #1476
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 CI | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'source/**' | |
- '**.md' | |
- '.**' | |
- 'fastlane/**' | |
pull_request: | |
paths-ignore: | |
- 'source/**' | |
- '**.md' | |
- '.**' | |
- 'fastlane/**' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
env: | |
NDK_VERSION: 26.3.11579264 | |
steps: | |
- name: Setup Repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
fetch-depth: 0 | |
- name: Install Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 21 | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Install NDK | |
run: echo "y" | sdkmanager --install "ndk;${{ env.NDK_VERSION }}" | |
- name: Install Cargo with aarch64-linux-android | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-linux-android | |
- name: Add Rust targe tarchitectures | |
run: | | |
rustup target add x86_64-linux-android | |
rustup target add armv7-linux-androideabi | |
- name: Retrieve version | |
run: | | |
echo VERSION=$(git rev-parse --short HEAD) >> $GITHUB_ENV | |
# Split due https://github.com/mozilla/rust-android-gradle/issues/38 | |
- name: Build with Gradle (debug) | |
run: ./gradlew -PappVerName=${{ env.VERSION }} assembleDebug | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
- name: Build with Gradle (release) | |
if: ${{ !github.event.pull_request }} | |
run: ./gradlew -PappVerName=${{ env.VERSION }} assembleRelease | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
- name: Sign Android release | |
if: ${{ !github.event.pull_request }} | |
id: sign | |
uses: r0adkll/sign-android-release@v1.0.4 | |
env: | |
BUILD_TOOLS_VERSION: "32.0.0" | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
- name: Upload debug apk | |
uses: actions/upload-artifact@v4 | |
if: ${{ !github.event.pull_request }} | |
with: | |
path: './app/build/outputs/apk/debug/*.apk' | |
name: build_debug_${{ env.VERSION }} | |
- name: Upload release apk | |
uses: actions/upload-artifact@v4 | |
if: ${{ !github.event.pull_request }} | |
with: | |
path: ${{ steps.sign.outputs.signedReleaseFile }} | |
name: build_release_${{ env.VERSION }} | |
- name: Get apk info | |
if: ${{ !github.event.pull_request }} | |
id: apk-info | |
uses: hkusu/apk-info-action@v1 | |
with: | |
apk-path: ${{ steps.sign.outputs.signedReleaseFile }} | |
# - name: Upload mappings with App Center CLI | |
# if: ${{ !github.event.pull_request }} | |
# uses: zhaobozhen/AppCenter-Github-Action@1.0.1 | |
# with: | |
# command: appcenter crashes upload-mappings --mapping app/build/outputs/mapping/release/mapping.txt --version-name ${{ steps.apk-info.outputs.version-name }} --version-code ${{ steps.apk-info.outputs.version-code }} --app DUpdateSystem/UpgradeAll | |
# token: ${{secrets.APP_CENTER_TOKEN}} | |
- name: Find debug APK | |
if: ${{ !github.event.pull_request }} | |
run: | | |
if [ ! -z "${{ secrets.BOT_TOKEN }}" ]; then | |
OUTPUT="app/build/outputs/apk/debug/" | |
DEBUG_APK=$(find $OUTPUT -name "*.apk") | |
echo "DEBUG_APK=$DEBUG_APK" >> $GITHUB_ENV | |
fi | |
- name: Generate Commit Message | |
if: ${{ !github.event.pull_request }} | |
run: | | |
COMMIT_MESSAGE=$(git log -1 --pretty=format:%s) | |
AUTHOR_NAME=$(git log -1 --pretty=format:%an) | |
REMOTE_URL=$(git remote get-url origin) | |
HOME_URL=$(echo $REMOTE_URL | sed -E "s|git@github.com:|https://github.com/|" | sed -E "s|\.git$||") | |
COMMIT_URL=$HOME_URL/commit/${{ env.VERSION }} | |
TELEGRAM_MESSAGE="New push to Github! | |
\`\`\`$COMMIT_MESSAGE\`\`\` | |
by \`$AUTHOR_NAME\` | |
See commit detail [Here]($COMMIT_URL) | |
Snapshot apk is attached" | |
echo "TELEGRAM_MESSAGE<<EOF" >> $GITHUB_ENV | |
echo "$TELEGRAM_MESSAGE" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Send commit to Telegram | |
if: ${{ !github.event.pull_request }} | |
uses: xz-dev/TelegramFileUploader@v1.1.1 | |
env: | |
BOT_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
API_ID: ${{ secrets.TELEGRAM_API_ID }} | |
API_HASH: ${{ secrets.TELEGRAM_API_HASH }} | |
with: | |
to-who: ${{ secrets.TELEGRAM_TO }} | |
message: ${{ env.TELEGRAM_MESSAGE }} | |
files: | | |
/github/workspace/${{ steps.sign.outputs.signedReleaseFile }} | |
/github/workspace/${{ env.DEBUG_APK }} |