Telegram CI #15
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: Telegram CI | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| message: | |
| required: false | |
| default: 'No message.' | |
| description: 'Message' | |
| buildType: | |
| description: "Build Type" | |
| type: choice | |
| required: true | |
| default: 'debugMin' | |
| options: | |
| - 'release' | |
| - 'playstore' | |
| - 'releaseCandidate' | |
| - 'beta' | |
| - 'alpha' | |
| - 'debug' | |
| - 'debugMin' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up signing key | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| if [ ! -z "${{ secrets.KEY_STORE }}" ]; then | |
| echo keyStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> signing.properties | |
| echo keyAlias='${{ secrets.KEY_ALIAS }}' >> signing.properties | |
| echo keyPassword='${{ secrets.KEY_PASSWORD }}' >> signing.properties | |
| echo keyStore='${{ github.workspace }}/key.jks' >> signing.properties | |
| echo ${{ secrets.KEY_STORE }} | base64 --decode > ${{ github.workspace }}/key.jks | |
| fi | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: 21 | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| with: | |
| validate-wrappers: true | |
| gradle-home-cache-cleanup: true | |
| - name: Build with Gradle | |
| run: chmod 755 ./gradlew && ./gradlew assembleDebugMin | |
| - name: Get release name | |
| if: success() && github.ref == 'refs/heads/main' | |
| id: release-name | |
| run: | | |
| name=`ls app/build/outputs/apk/debugMin/*.apk | awk -F '(/|.apk)' '{print $6}'` && echo "name=${name}" >> $GITHUB_OUTPUT | |
| - name: Find APK | |
| id: find_apk | |
| run: | | |
| APK_PATH=$(find app/build/outputs/apk/debugMin -name "*.apk" | head -n 1) | |
| echo "APK_PATH=$APK_PATH" >> $GITHUB_ENV | |
| - name: Get commit info and build timestamp | |
| id: meta | |
| run: | | |
| COMMIT_HASH=$(git rev-parse --short HEAD) | |
| BUILD_DATE=$(date +"%Y-%m-%d %H:%M:%S") | |
| VERSION=$(git rev-list --count HEAD) | |
| echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_ENV | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV | |
| - name: Upload files to Telegram | |
| uses: xz-dev/TelegramFileUploader@v1.1.1 | |
| with: | |
| to-who: '@MMRLCI' | |
| message: |- | |
| **CI Manager (TEST BUILD)** | |
| #ci_${{ env.VERSION }} | |
| Build on ${{ env.BUILD_DATE}}. | |
| ```${{ inputs.message }}``` | |
| [${{ env.COMMIT_HASH }}](${{ github.event.head_commit.url }}) | |
| [Workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
| files: ${{ env.APK_PATH }} | |
| env: | |
| API_ID: ${{ secrets.API_ID }} | |
| API_HASH: ${{ secrets.API_HASH }} | |
| BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
| - name: Upload built apk | |
| if: success() && github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.release-name.outputs.name }} | |
| path: app/build/outputs/apk/debugMin/*.apk | |
| - name: Upload mappings | |
| if: success() && github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mappings | |
| path: app/build/outputs/mapping/debugMin |