Initial commit #3
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: Build and Upload APK | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| # watch: | |
| # types: [ started ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Install dependencies | |
| run: | | |
| # 安装 apktool | |
| wget https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool | |
| wget https://github.com/iBotPeaches/Apktool/releases/download/v2.7.0/apktool_2.7.0.jar | |
| chmod +x apktool apktool_2.7.0.jar | |
| sudo mv apktool apktool_2.7.0.jar /usr/local/bin/ | |
| sudo ln -s /usr/local/bin/apktool_2.7.0.jar /usr/local/bin/apktool.jar | |
| # 安装 Android SDK Command Line Tools | |
| wget https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip | |
| unzip commandlinetools-linux-10406996_latest.zip | |
| sudo mkdir -p /opt/android-sdk | |
| sudo mv cmdline-tools /opt/android-sdk/ | |
| echo "ANDROID_HOME=/opt/android-sdk" >> $GITHUB_ENV | |
| echo "PATH=$PATH:/opt/android-sdk/cmdline-tools/latest/bin:/opt/android-sdk/build-tools/34.0.0" >> $GITHUB_ENV | |
| # 安装 build-tools | |
| yes | /opt/android-sdk/cmdline-tools/bin/sdkmanager --sdk_root=/opt/android-sdk "build-tools;34.0.0" | |
| - name: Check dependencies | |
| run: | | |
| java -version | |
| apktool --version | |
| which zipalign | |
| which apksigner | |
| - name: Create config.json if not exists | |
| run: | | |
| if [ ! -f config.json ]; then | |
| cat > config.json << 'EOF' | |
| [ | |
| ["com.example.app", "ModifiedApp", 9999, "9999.0.0"] | |
| ] | |
| EOF | |
| fi | |
| - name: Run main.py | |
| run: | | |
| python3 main.py | |
| - name: Upload APK artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: modified-apks | |
| path: output/*.apk |