Nagram/.github/workflows/release.yml

263 lines
9.0 KiB
YAML
Raw Normal View History

2021-02-18 02:32:17 +00:00
name: Release Build
on:
2022-02-10 08:03:52 +00:00
push:
branches:
2022-03-16 18:05:22 +00:00
- main
2022-02-10 08:03:52 +00:00
paths-ignore:
- '**.md'
- '.github/**'
- '!.github/workflows/release.yml'
2021-02-18 02:32:17 +00:00
workflow_dispatch:
inputs:
upload:
description: 'Upload: If want ignore'
required: false
jobs:
check:
name: Check Access
runs-on: ubuntu-latest
steps:
- name: "Check access"
uses: "lannonbr/repo-permission-check-action@2.0.0"
with:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2021-02-25 11:55:43 +00:00
ffmpeg:
2021-03-05 05:38:05 +00:00
name: Native Build (FFmpeg)
2021-02-25 11:55:43 +00:00
runs-on: ubuntu-latest
2021-03-05 04:10:37 +00:00
needs: check
2021-02-25 11:55:43 +00:00
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
2022-03-13 17:47:29 +00:00
run: |
sed -i 's/\/\///g' settings.gradle
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status
2022-03-15 14:53:11 +00:00
git submodule status TMessagesProj/jni/libvpx > libvpx_status
2021-02-25 11:55:43 +00:00
- name: FFmpeg Cache
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/jni/ffmpeg/build
2022-02-04 03:49:46 +00:00
TMessagesProj/jni/libvpx/build
2022-03-13 15:27:52 +00:00
key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }}
2024-01-19 02:57:17 +00:00
- name: Set up JDK 17
uses: actions/setup-java@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
java-version: '17'
distribution: 'temurin'
2021-02-25 11:55:43 +00:00
- name: Setup Android SDK Tools
2024-01-19 02:57:17 +00:00
uses: android-actions/setup-android@v3
2021-02-25 11:55:43 +00:00
if: steps.cache.outputs.cache-hit != 'true'
- name: Install NDK
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
2021-02-25 11:55:43 +00:00
echo "sdk.dir=${ANDROID_HOME}" > local.properties
2021-03-26 02:01:53 +00:00
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
2021-02-25 11:55:43 +00:00
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: |
2022-02-04 03:49:46 +00:00
sudo apt-get install yasm -y
./run init libs libvpx
2021-02-25 11:55:43 +00:00
./run init libs ffmpeg
boringssl:
2021-03-05 05:38:05 +00:00
name: Native Build (BoringSSL)
2021-02-18 02:32:17 +00:00
runs-on: ubuntu-latest
2021-03-05 04:10:37 +00:00
needs: check
2021-02-18 02:32:17 +00:00
steps:
- name: Checkout
uses: actions/checkout@v2
2021-02-25 11:55:43 +00:00
- name: Fetch Status
2022-03-13 17:47:29 +00:00
run: |
sed -i 's/\/\///g' settings.gradle
git submodule status TMessagesProj/jni/boringssl > boringssl_status
2021-02-25 11:55:43 +00:00
- name: BoringSSL Cache
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/jni/boringssl/build
key: ${{ hashFiles('boringssl_status') }}
2024-01-19 02:57:17 +00:00
- name: Set up JDK 17
uses: actions/setup-java@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
java-version: '17'
distribution: 'temurin'
2021-02-18 02:32:17 +00:00
- name: Setup Android SDK Tools
2024-01-19 02:57:17 +00:00
uses: android-actions/setup-android@v3
2021-02-25 11:55:43 +00:00
if: steps.cache.outputs.cache-hit != 'true'
- name: Install NDK
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
2021-02-25 11:55:43 +00:00
echo "sdk.dir=${ANDROID_HOME}" > local.properties
2021-03-26 02:01:53 +00:00
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
2021-02-25 11:55:43 +00:00
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: |
./run init action boringssl
./run init libs boringssl
native:
2021-03-05 05:38:05 +00:00
name: Native Build (Telegram)
2021-02-25 11:55:43 +00:00
runs-on: ubuntu-latest
needs:
- ffmpeg
- boringssl
2021-03-31 19:29:44 +00:00
strategy:
matrix:
flavor:
- armeabi-v7a
- arm64-v8a
2021-02-25 11:55:43 +00:00
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: |
2022-03-13 17:47:29 +00:00
sed -i 's/\/\///g' settings.gradle
2021-02-25 11:55:43 +00:00
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status
2022-02-04 03:49:46 +00:00
git submodule status TMessagesProj/jni/libvpx > libvpx_status
2021-02-25 11:55:43 +00:00
git submodule status TMessagesProj/jni/boringssl > boringssl_status
2021-02-18 02:32:17 +00:00
- name: Native Cache
2021-02-25 11:55:43 +00:00
id: cache
uses: actions/cache@v2
2021-02-18 02:32:17 +00:00
with:
path: |
2022-02-04 13:57:35 +00:00
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-${{ matrix.flavor }}
2021-02-25 11:55:43 +00:00
- name: Checkout Library
if: steps.cache.outputs.cache-hit != 'true'
2021-02-18 02:32:17 +00:00
run: |
2021-02-25 11:55:43 +00:00
git submodule update --init 'TMessagesProj/jni/*'
- name: FFmpeg Cache
uses: actions/cache@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
TMessagesProj/jni/ffmpeg/build
2022-02-04 13:57:35 +00:00
TMessagesProj/jni/libvpx/build
2022-03-13 15:27:52 +00:00
key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }}
2021-02-25 11:55:43 +00:00
- name: BoringSSL Cache
uses: actions/cache@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
TMessagesProj/jni/boringssl/build
key: ${{ hashFiles('boringssl_status') }}
2024-01-19 02:57:17 +00:00
- name: Set up JDK 17
uses: actions/setup-java@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
java-version: '17'
distribution: 'temurin'
2021-02-25 11:55:43 +00:00
- name: Setup Android SDK Tools
2024-01-19 02:57:17 +00:00
uses: android-actions/setup-android@v3
2021-02-25 11:55:43 +00:00
if: steps.cache.outputs.cache-hit != 'true'
2021-02-18 02:32:17 +00:00
- name: Install NDK
2021-02-25 11:55:43 +00:00
if: steps.cache.outputs.cache-hit != 'true'
2021-02-18 02:32:17 +00:00
run: |
echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
2021-02-18 02:32:17 +00:00
echo "sdk.dir=${ANDROID_HOME}" > local.properties
2021-03-26 02:01:53 +00:00
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
2021-02-25 11:55:43 +00:00
- name: Fix BoringSSL
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd TMessagesProj/jni
./patch_boringssl.sh
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: |
2021-03-31 19:29:44 +00:00
export NATIVE_TARGET="${{ matrix.flavor }}"
2021-02-25 11:55:43 +00:00
./run libs native
2021-02-18 02:32:17 +00:00
build:
2021-03-16 14:47:37 +00:00
name: Gradle Build
2021-02-18 02:32:17 +00:00
runs-on: ubuntu-latest
2021-02-25 11:55:43 +00:00
needs:
- native
2021-02-18 02:32:17 +00:00
steps:
- name: Checkout
uses: actions/checkout@v2
2024-01-19 02:57:17 +00:00
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
2021-02-18 02:32:17 +00:00
- name: Setup Android SDK Tools
2024-01-19 02:57:17 +00:00
uses: android-actions/setup-android@v3
2022-06-21 12:43:22 +00:00
- name: Install NDK
run: |
echo "y" | sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
2022-06-21 12:43:22 +00:00
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
2021-02-25 11:55:43 +00:00
- name: Fetch Status
run: |
2022-03-13 17:47:29 +00:00
sed -i 's/\/\///g' settings.gradle
2021-02-25 11:55:43 +00:00
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status
git submodule status TMessagesProj/jni/boringssl > boringssl_status
2021-03-31 19:29:44 +00:00
- name: Native Cache (armeabi-v7a)
uses: actions/cache@v2
with:
path: |
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-armeabi-v7a
- name: Native Cache (arm64-v8a)
uses: actions/cache@v2
with:
path: |
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}-arm64-v8a
2022-07-12 13:29:44 +00:00
- name: Configure Gradle
2021-02-18 02:32:17 +00:00
run: |
sed -i -e "s/16384/6144/g" gradle.properties
2022-07-12 13:29:44 +00:00
echo "sdk.dir=${ANDROID_HOME}" >> local.properties
2021-02-18 02:32:17 +00:00
- name: Gradle cache
2021-02-25 11:55:43 +00:00
uses: actions/cache@v2
2021-02-18 02:32:17 +00:00
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle') }}
- name: Release Build
run: |
export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}"
./gradlew TMessagesProj:assembleRelease
2021-02-18 02:32:17 +00:00
APK=$(find TMessagesProj/build/outputs/apk -name '*arm64-v8a*.apk')
APK=$(dirname $APK)
echo "APK=$APK" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
with:
name: Release
2021-02-18 02:32:17 +00:00
path: ${{ env.APK }}
upload:
2022-07-12 13:29:44 +00:00
name: Upload release
2021-02-18 02:32:17 +00:00
if: github.event.inputs.upload != 'y'
runs-on: ubuntu-latest
needs:
- build
2021-02-18 02:32:17 +00:00
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Donwload Artifacts
2021-02-18 02:32:17 +00:00
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
2022-07-12 13:29:44 +00:00
- name: Send to Telegram
2021-02-18 02:32:17 +00:00
run: |
2022-03-18 19:41:33 +00:00
# send release via telegram bot api
2024-02-18 04:08:55 +00:00
export mini64=$(find artifacts -name "*arm64-v8a.apk")
export mini32=$(find artifacts -name "*armeabi-v7a.apk")
2022-03-20 19:22:10 +00:00
echo $mini64
echo $mini32
python -m pip install -r bin/scripts/requirements.txt
2024-03-16 16:01:07 +00:00
git log -1 --pretty=format:"%s%n%n%b" > artifacts/caption.txt
python bin/scripts/upload.py ${{ secrets.HELPER_BOT_TOKEN }} ${{ secrets.HELPER_BOT_TARGET }} release