Build #12
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 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| Alpha: | |
| description: 'Alpha' | |
| required: true | |
| default: 'true' | |
| Premium: | |
| description: 'Premium' | |
| required: true | |
| default: 'false' | |
| Foss: | |
| description: 'Foss' | |
| required: true | |
| default: 'false' | |
| release_type: | |
| description: 'Release Type' | |
| required: true | |
| type: choice | |
| options: | |
| - pre-release | |
| - release | |
| default: 'pre-release' | |
| version_name: | |
| description: 'Version Name (e.g., 2.0.13-S3)' | |
| required: false | |
| default: '' | |
| version_code: | |
| description: 'Version Code (e.g., 3501200)' | |
| required: false | |
| default: '' | |
| jobs: | |
| build: | |
| name: "Build APKs" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: s3 # 指定使用 s3 分支 | |
| - name: Validate gradle wrapper | |
| uses: gradle/wrapper-validation-action@v1 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: 17 | |
| - name: Setup gradle | |
| uses: gradle/gradle-build-action@v2 | |
| - name: Change to source directory | |
| run: cd source | |
| - name: Setup gradlew | |
| run: chmod +x gradlew | |
| working-directory: source | |
| - name: Check build-logic | |
| run: ./gradlew check -p build-logic | |
| working-directory: source | |
| - name: Build with gradle (Skip signing) | |
| id: gradle | |
| env: | |
| BUILD_ALPHA: ${{ github.event.inputs.Alpha }} | |
| BUILD_PREMIUM: ${{ github.event.inputs.Premium }} | |
| BUILD_FOSS: ${{ github.event.inputs.Foss }} | |
| run: | | |
| echo "Building without signing - using debug variants" | |
| TASKS="" | |
| if [ "${BUILD_ALPHA}" = 'true' ]; then | |
| TASKS="$TASKS assembleArm64-v8aAlphaDebug assembleArmeabi-v7aAlphaDebug assembleX86AlphaDebug assembleX86_64AlphaDebug" | |
| fi | |
| if [ "${BUILD_PREMIUM}" = 'true' ]; then | |
| TASKS="$TASKS assembleArm64-v8aPremiumDebug assembleArmeabi-v7aPremiumDebug assembleX86PremiumDebug assembleX86_64PremiumDebug" | |
| fi | |
| if [ "${BUILD_FOSS}" = 'true' ]; then | |
| TASKS="$TASKS assembleArm64-v8aFossDebug assembleArmeabi-v7aFossDebug assembleX86FossDebug assembleX86_64FossDebug" | |
| fi | |
| if [ -z "${TASKS}" ]; then | |
| TASKS="assembleDebug" | |
| fi | |
| echo "Running tasks: $TASKS" | |
| ./gradlew $TASKS --daemon --parallel | |
| working-directory: source | |
| - name: Move APKs to root | |
| run: | | |
| # 在 source 目录创建 APKs 目录并移动文件 | |
| mkdir -p ../build-output | |
| find . -name "*.apk" -exec mv {} ../build-output/ \; | |
| echo "APK files in root build-output:" | |
| ls -la ../build-output/ | |
| working-directory: source | |
| - name: Upload APKs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: APKs | |
| path: build-output/*.apk | |
| - name: Get version name | |
| id: version | |
| run: | | |
| if [ -n "${{ github.event.inputs.version_name }}" ]; then | |
| VERSION="${{ github.event.inputs.version_name }}" | |
| else | |
| VERSION=$(grep "versionName" gradle/libs.versions.toml | cut -d'"' -f2) | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| if [ -n "${{ github.event.inputs.version_code }}" ]; then | |
| CODE="${{ github.event.inputs.version_code }}" | |
| else | |
| CODE=$(grep "versionCode" gradle/libs.versions.toml | cut -d'"' -f2) | |
| fi | |
| echo "code=$CODE" >> $GITHUB_OUTPUT | |
| working-directory: source | |
| - name: Create Release | |
| if: github.event.inputs.release_type != '' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| name: v${{ steps.version.outputs.version }} | |
| prerelease: ${{ github.event.inputs.release_type == 'pre-release' }} | |
| files: build-output/*.apk | |
| body: | | |
| ## What's New in v${{ steps.version.outputs.version }} | |
| ### Version Info | |
| - Version Name: ${{ steps.version.outputs.version }} | |
| - Version Code: ${{ steps.version.outputs.code }} | |
| ### Features | |
| - Build type: ${{ github.event.inputs.release_type }} | |
| - Alpha: ${{ github.event.inputs.Alpha }} | |
| - Premium: ${{ github.event.inputs.Premium }} | |
| - Foss: ${{ github.event.inputs.Foss }} | |
| - Branch: s3 (S3-specific features) | |
| ### Note | |
| ⚠️ This is a DEBUG build without signing, for testing purposes only. | |
| ### Download | |
| Choose the APK file matching your device architecture: | |
| - arm64-v8a (recommended for most modern devices) | |
| - armeabi-v7a (for older 32-bit ARM devices) | |
| - x86_64 (for x86 64-bit devices) | |
| - x86 (for x86 32-bit devices) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |