Skip to content

Telegram CI

Telegram CI #46

Workflow file for this run

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: Parse input
run: |
BUILD_TYPE_CASED=$(echo "${{ inputs.buildType }}" | sed 's/^\(.\)/\L\1/')
echo "BUILD_TYPE_CASED=$BUILD_TYPE_CASED" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up signing key
if: github.ref == 'refs/heads/master'
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@v4
with:
validate-wrappers: true
gradle-home-cache-cleanup: true
- name: Build with Gradle
run: chmod 755 ./gradlew && ./gradlew assemble${{ inputs.buildType }}
- name: Get release name
if: success() && github.ref == 'refs/heads/master'
id: release-name
run: |
name=`ls app/build/outputs/apk/${{ env.BUILD_TYPE_CASED }}/*.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/${{ env.BUILD_TYPE_CASED }} -name "*.apk" | head -n 1)
echo "APK_PATH=$APK_PATH" >> $GITHUB_ENV
- name: Get commit info and build timestamp
id: meta
run: |
BUILD_DATE=$(date +"%Y-%m-%d %H:%M:%S")
VERSION=$(git rev-list --count HEAD)
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**
#ci_${{ env.VERSION }}
Build on ${{ env.BUILD_DATE }}.
```${{ inputs.message }}```
Type: ${{ env.BUILD_TYPE_CASED }}
[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/master'
uses: actions/upload-artifact@v4
with:
name: ${{ steps.release-name.outputs.name }}
path: app/build/outputs/apk/${{ env.BUILD_TYPE_CASED }}/*.apk
- name: Upload mappings
if: success() && github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v4
with:
name: mappings
path: app/build/outputs/mapping/${{ env.BUILD_TYPE_CASED }}