fix: entity lost in merge message #161
This file contains 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 CI | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
- '**.txt' | |
- '.github/**' | |
- '!.github/workflows/**' | |
- "TMessagesProj/src/main/res/values**/**" | |
- '.gitignore' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Gradle Build | |
if: ${{ github.event_name != 'pull_request' && success() && github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
env: | |
CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" | |
CCACHE_NOHASHDIR: "true" | |
CCACHE_MAXSIZE: "10G" | |
CCACHE_HARDLINK: "true" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
fetch-depth: 0 | |
- name: Get short SHA | |
run: | | |
echo "SHA7=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_ENV | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Cache Gradle Build | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches/build-cache-* | |
~/.gradle/buildOutputCleanup/cache.properties | |
key: gradle-builds-${{ github.sha }} | |
restore-keys: | | |
gradle-builds | |
- name: Set up ccache | |
uses: hendrikmuhs/[email protected] | |
with: | |
key: ccache | |
restore-keys: ccache | |
- name: Setup Android SDK Tools | |
uses: android-actions/setup-android@v2 | |
- name: Install Android NDK | |
run: | | |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;23.2.8568313" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null | |
echo "sdk.dir=${ANDROID_HOME}" > local.properties | |
echo "ndk.dir=${ANDROID_HOME}/ndk/23.2.8568313" >> local.properties | |
- name: Prepare Environment | |
run: | | |
echo "Removing large packages" | |
sudo apt-get update | |
sudo apt-get remove -y '^dotnet-.*' aspnetcore-targeting-pack-6.0 aspnetcore-targeting-pack-7.0 | |
sudo apt-get remove -y '^llvm-.*' | |
sudo apt-get remove -y 'php.*' | |
sudo apt-get remove -y '^mongodb-.*' | |
sudo apt-get remove -y '^mysql-.*' | |
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri | |
sudo apt-get autoremove -y | |
sudo apt-get clean | |
echo "Removing large directories" | |
sudo rm -rf /usr/share/dotnet/ | |
sudo rm -rf /usr/local/graalvm/ | |
sudo rm -rf /usr/local/.ghcup/ | |
sudo rm -rf /usr/local/share/powershell | |
sudo rm -rf /usr/local/share/chromium | |
sudo rm -rf /usr/local/lib/node_modules | |
df -h | |
sudo apt-get install bison gcc make curl ninja-build ccache -y | |
- name: Debug Build | |
run: | | |
echo -e "RELEASE_KEY_PASSWORD=${{ secrets.RELEASE_KEY_PASSWORD }}\nRELEASE_KEY_ALIAS=${{ secrets.RELEASE_KEY_ALIAS }}\nRELEASE_STORE_PASSWORD=${{ secrets.RELEASE_STORE_PASSWORD }}">>local.properties | |
cat > service_account_credentials.json << EOF | |
${{ secrets.ANDROID_PUBLISHER_CREDENTIALS }}" | |
EOF | |
./gradlew TMessagesProj:assembleRelease | |
echo "APK_FILE=$(find TMessagesProj/build/outputs/apk -name '*arm64*.apk')" >> $GITHUB_ENV | |
- uses: actions/upload-artifact@v3 | |
name: Upload apk (arm64-v8a) | |
with: | |
name: Nnngram-arm64-v8a-${{ env.SHA7 }} | |
path: ${{ env.APK_FILE }} | |
- name: Upload mapping | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mapping | |
path: TMessagesProj/build/outputs/mapping | |
upload: | |
name: Upload Release | |
if: ${{ github.event_name != 'pull_request' && success() && github.ref == 'refs/heads/main' }} | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- telegram-bot-api | |
steps: | |
- name: Donwload Artifacts | |
uses: actions/download-artifact@master | |
with: | |
path: artifacts | |
- name: Download Telegram Bot API Binary | |
uses: actions/download-artifact@master | |
with: | |
name: telegram-bot-api-binary | |
path: . | |
- name: find apk | |
run: | | |
mkdir apks | |
find artifacts -name "*.apk" -exec cp {} apks \; | |
echo "APK_FILE_UPLOAD=$(find apks -name '*arm64*.apk')" >> $GITHUB_ENV | |
- name: Get Apk Info | |
id: apk | |
uses: QueallyTech/read-apk-info-action@v1 | |
with: | |
apkPath: ${{ env.APK_FILE_UPLOAD }} | |
- name: Release | |
run: | | |
chmod +x telegram-bot-api-binary | |
./telegram-bot-api-binary --api-id=21724 --api-hash=3e0cb5efcd52300aec5994fdfc5bdc16 --local 2>&1 > /dev/null & | |
curl https://raw.githubusercontent.com/PreviousAlone/ActionScript/main/uploadCI.py -o uploadCI.py | |
python uploadCI.py | |
env: | |
CHAT_ID: ${{ secrets.TELEGRAM_CHATID }} | |
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }} | |
VERSION_CODE: ${{ steps.apk.outputs.versionCode }} | |
VERSION_NAME: ${{ steps.apk.outputs.versionNum }} | |
COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
telegram-bot-api: | |
name: Telegram Bot API | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Clone Telegram Bot API | |
run: | | |
git clone --recursive https://github.com/tdlib/telegram-bot-api.git | |
git status telegram-bot-api >> telegram-bot-api-status | |
- name: Cache Bot API Binary | |
id: cache-bot-api | |
uses: actions/cache@v3 | |
with: | |
path: telegram-bot-api-binary | |
key: CI-telegram-bot-api-${{ hashFiles('telegram-bot-api-status') }} | |
- name: Compile Telegram Bot API | |
if: steps.cache-bot-api.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get update | |
sudo apt-get install make git zlib1g-dev libssl-dev gperf cmake g++ | |
cd telegram-bot-api | |
rm -rf build | |
mkdir build | |
cd build | |
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=.. .. | |
cmake --build . --target install -j$(nproc) | |
cd ../.. | |
ls -l telegram-bot-api/bin/telegram-bot-api* | |
cp telegram-bot-api/bin/telegram-bot-api telegram-bot-api-binary | |
- name: Upload Binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: telegram-bot-api-binary | |
path: telegram-bot-api-binary |