Release CI #19
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: Release CI | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| title: | |
| required: false | |
| default: '**CI Manager**' | |
| description: 'Title' | |
| message: | |
| required: false | |
| default: 'No message.' | |
| description: 'Message' | |
| send_telegram: | |
| description: 'Release to Telegram' | |
| required: true | |
| default: false | |
| type: boolean | |
| send_playstore: | |
| description: 'Release on Play Store' | |
| required: true | |
| default: false | |
| type: boolean | |
| send_github: | |
| description: 'Release on GitHub' | |
| required: true | |
| default: false | |
| type: boolean | |
| buildType: | |
| description: "Build Type" | |
| type: choice | |
| required: true | |
| default: 'Alpha' | |
| options: | |
| - 'Release' | |
| - 'Playstore' | |
| - 'ReleaseCandidate' | |
| - 'Beta' | |
| - 'Alpha' | |
| - 'Debug' | |
| - 'DebugMin' | |
| jobs: | |
| spoofed-build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| spoofed_apk_path: ${{ steps.find_apk.outputs.APK_PATH }} | |
| spoofed_mapping_path: ${{ steps.find_mapping.outputs.MAPPING_PATH }} | |
| steps: | |
| - name: Parse input | |
| run: echo "BUILD_TYPE_CASED=$(echo '${{ inputs.buildType }}' | sed 's/^\(.*\)$/\L\1/')" >> $GITHUB_ENV | |
| - name: Checkout | |
| uses: actions/checkout@v4.2.2 | |
| - name: Spoof Package ID | |
| run: chmod 755 spoof && ./spoof | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4.7.1 | |
| with: | |
| distribution: 'zulu' | |
| java-version: 21 | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4.3.1 | |
| - name: Build Spoofed APK | |
| run: chmod 755 gradlew && ./gradlew assemble${{ inputs.buildType }} | |
| - name: Find APK | |
| id: find_apk | |
| run: | | |
| APK_PATH=$(find app/build/outputs/apk/${{ env.BUILD_TYPE_CASED }} -name "*.apk" | head -n 1) | |
| echo "APK_PATH=$APK_PATH" >> $GITHUB_OUTPUT | |
| - name: Find mapping file | |
| id: find_mapping | |
| run: | | |
| MAPPING_PATH=$(find app/build/outputs/mapping/${{ env.BUILD_TYPE_CASED }} -name "mapping.txt" | head -n 1) | |
| echo "MAPPING_PATH=$MAPPING_PATH" >> $GITHUB_OUTPUT | |
| - name: Upload spoofed mapping as artifact | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: spoofed-mapping | |
| path: ${{ steps.find_mapping.outputs.MAPPING_PATH }} | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: spoofed-build | |
| steps: | |
| - name: Parse input | |
| run: echo "BUILD_TYPE_CASED=$(echo '${{ inputs.buildType }}' | sed 's/^\(.*\)$/\L\1/')" >> $GITHUB_ENV | |
| - name: Checkout | |
| uses: actions/checkout@v4.2.2 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4.7.1 | |
| with: | |
| distribution: 'zulu' | |
| java-version: 21 | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v4.3.1 | |
| - name: Build APK | |
| run: chmod 755 gradlew && ./gradlew assemble${{ inputs.buildType }} | |
| - name: Find APK | |
| id: find_apk | |
| run: | | |
| APK_PATH=$(find app/build/outputs/apk/${{ env.BUILD_TYPE_CASED }} -name "*.apk" | head -n 1) | |
| echo "APK_PATH=$APK_PATH" >> $GITHUB_ENV | |
| - name: Find mapping file | |
| id: normal_mapping | |
| run: | | |
| MAPPING_PATH=$(find app/build/outputs/mapping/${{ env.BUILD_TYPE_CASED }} -name "mapping.txt" | head -n 1) | |
| echo "MAPPING_PATH=$MAPPING_PATH" >> $GITHUB_ENV | |
| - name: Get commit info and build timestamp | |
| id: meta | |
| run: | | |
| BUILD_DATE=$(date +"%Y-%m-%d %H:%M:%S") | |
| COMMIT_COUNT=$(git rev-list --count HEAD) | |
| VERSION=$((31320 + COMMIT_COUNT)) | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV | |
| - name: Upload files to Telegram | |
| if: github.event.inputs.send_telegram == 'true' | |
| uses: xz-dev/TelegramFileUploader@v1.1.1 | |
| with: | |
| to-who: '@MMRLCI' | |
| message: |- | |
| ${{ inputs.title }} | |
| #ci_${{ env.VERSION }} | |
| Build on ${{ env.BUILD_DATE }}. | |
| **What's new?** | |
| ${{ inputs.message }} | |
| Type: ${{ env.BUILD_TYPE_CASED }} | |
| [Workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
| files: | | |
| ${{ env.APK_PATH }} | |
| ${{ needs.spoofed-build.outputs.spoofed_apk_path }} | |
| env: | |
| API_ID: ${{ secrets.API_ID }} | |
| API_HASH: ${{ secrets.API_HASH }} | |
| BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| - name: Create GitHub Release | |
| if: github.event.inputs.send_github == 'true' | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| release_name: v${{ env.VERSION }} | |
| body: | | |
| ${{ inputs.title }} | |
| #ci_${{ env.VERSION }} | |
| Build on ${{ env.BUILD_DATE }}. | |
| ## What's new? | |
| ${{ inputs.message }} | |
| Type: ${{ env.BUILD_TYPE_CASED }} | |
| [Workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload normal APK to GitHub Release | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.APK_PATH }} | |
| asset_name: normal.apk | |
| asset_content_type: application/vnd.android.package-archive | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload spoofed APK to GitHub Release | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ needs.spoofed-build.outputs.spoofed_apk_path }} | |
| asset_name: spoofed.apk | |
| asset_content_type: application/vnd.android.package-archive | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload normal mapping to GitHub Release | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ env.MAPPING_PATH }} | |
| asset_name: mapping.txt | |
| asset_content_type: text/plain | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload spoofed mapping to GitHub Release | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ needs.spoofed-build.outputs.spoofed_mapping_path }} | |
| asset_name: spoofed-mapping.txt | |
| asset_content_type: text/plain | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload normal mapping as artifact | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: mapping | |
| path: ${{ env.MAPPING_PATH }} | |
| - name: Upload spoofed mapping as artifact | |
| uses: actions/upload-artifact@v4.6.2 | |
| with: | |
| name: spoofed-mapping | |
| path: ${{ needs.spoofed-build.outputs.spoofed_mapping_path }} |