IoT Explorer Link App v1.5.6 版本 #164
Workflow file for this run
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: Android Release CI | |
on: | |
release: | |
types: [published] | |
env: | |
IOT_SONATYPE_USERNAME: ${{ secrets.IOT_SONATYPE_USERNAME }} | |
IOT_SONATYPE_PASSWORD: ${{ secrets.IOT_SONATYPE_PASSWORD }} | |
IOT_RELEASE_KEYSTORE_PASSWORD: ${{ secrets.IOT_RELEASE_KEYSTORE_PASSWORD }} | |
GPG_DECRYPT_PASSPHRASE: ${{ secrets.GPG_DECRYPT_PASSPHRASE }} | |
IOT_GPG_KEYNAME: ${{ secrets.IOT_GPG_KEYNAME }} | |
IOT_GPG_PASSPHRASE: ${{ secrets.IOT_GPG_PASSPHRASE }} | |
IOT_GITHUB_ACCESS_TOKEN: ${{ secrets.IOT_GITHUB_ACCESS_TOKEN }} | |
IOT_WECOM_CID_ROBOT_KEY: ${{ secrets.IOT_WECOM_CID_ROBOT_KEY }} | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- run: | | |
rm -rf app-config.json app/google-services.json | |
gpg -d --passphrase "$GPG_DECRYPT_PASSPHRASE" --batch --quiet .github/tencent_official_keystore.jks.asc > tencent_official_keystore.jks | |
gpg -d --passphrase "$GPG_DECRYPT_PASSPHRASE" --batch --quiet .github/app-config.json.asc > app-config.json | |
gpg -d --passphrase "$GPG_DECRYPT_PASSPHRASE" --batch --quiet .github/app/google-services.json.asc > app/google-services.json | |
gpg -d --passphrase "$GPG_DECRYPT_PASSPHRASE" --batch --quiet .github/sdk/secring.gpg.asc > secring.gpg | |
- name: set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
# - name: Setup cmake | |
# uses: jwlawson/actions-setup-cmake@v1.5 | |
# with: | |
# cmake-version: '3.10.2' | |
- name: Use cmake | |
run: | | |
cmake --version | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/secring.gpg.asc') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Common-->install fir | |
run: sudo gem install fir-cli | |
- name: Common-->Setup NDK | |
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;22.1.7171670" | |
- name: Common-->Fix App Version | |
run: | | |
rb=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
rtt=$(git describe --tags `git rev-list --tags --max-count=1`) | |
rt=${rtt#*v} | |
echo "curr_tag=$rtt" >> $GITHUB_ENV | |
rc=$(git rev-parse --short HEAD) | |
sed -i 's#def versionAppName.*#def versionAppName = \"'$rt'\"#g' config.gradle | |
sed -i 's#def sdkVersion.*#def sdkVersion = \"'$rt'\"#g' config.gradle | |
sed -i "s#xxx#$rb+git.$rc#g" config.gradle | |
sed -i '/snapshots/, +d' build.gradle | |
- name: Common-->Update Values of Signing | |
run: | | |
export KEY_ID_OF_SIGN=$IOT_GPG_KEYNAME | |
export PASSWORD_OF_SIGN=$IOT_GPG_PASSPHRASE | |
sh .github/scripts/updateValuesForSign.sh | |
- name: Link-->Update Link App VersionCode | |
if: ${{!contains(env.curr_tag, 'video')}} | |
run: | | |
sh .github/scripts/updateVersionCode.sh | |
- name: Link-->Adapt build.gradle from debug to release | |
if: ${{!contains(env.curr_tag, 'video')}} | |
run: | | |
sed -i 's#opensource_keystore#tencent_official_keystore#g' app/build.gradle | |
sed -i '/opensource {/, +4d' app/build.gradle | |
sed -i 's#//-##g' app/build.gradle | |
sed -i "s#'111222'#System.getenv(\"IOT_RELEASE_KEYSTORE_PASSWORD\")#g" app/build.gradle | |
sed -i 's#-SNAPSHOT##g' sdk/explorer-link-android/build.gradle | |
sed -i 's#-SNAPSHOT##g' sdk/explorer-link-rtc/build.gradle | |
- name: Video-->Update Video SDK Version | |
if: ${{contains(env.curr_tag, 'video')}} | |
run: | | |
export VIDEO_TAG=${{env.curr_tag}} | |
bash .github/scripts/updateVideoSDKVersion.sh | |
- name: Video-->Build Video with Gradle | |
if: ${{contains(env.curr_tag, 'video')}} | |
run: | | |
./gradlew :sdk:video-link-android:build :sdkdemo:build | |
- name: Video-->Publish aar to Maven | |
if: ${{contains(env.curr_tag, 'video')}} | |
run: ./gradlew :sdk:video-link-android:publish | |
- name: Link-->Build Link with Gradle | |
if: ${{!contains(env.curr_tag, 'video')}} | |
run: ./gradlew :sdk:explorer-link-android:build :sdk:explorer-link-rtc:build :app:build | |
- name: Link-->Package apk and aar with Gradle | |
if: ${{!contains(env.curr_tag, 'video')}} | |
run: ./gradlew assembleTencentOfficial | |
- name: Link-->Publish aar to Maven | |
if: ${{!contains(env.curr_tag, 'video')}} | |
run: ./gradlew :sdk:explorer-link-android:publish :sdk:explorer-link-rtc:publish | |
- name: Link-->Update iot-version-android.txt in iot-version repo | |
if: ${{!contains(env.curr_tag, 'video')}} | |
run: sh .github/scripts/updateVersionInIotVersionRepo.sh | |
- name: Link-->Encrypt Link Apk | |
if: ${{!contains(env.curr_tag, 'video')}} | |
run: | | |
gpg --batch --passphrase "$GPG_DECRYPT_PASSPHRASE" -c app/build/outputs/apk/tencentOfficial/debug/*.apk | |
gpg --batch --passphrase "$GPG_DECRYPT_PASSPHRASE" -c app/build/outputs/apk/tencentOfficial/release/*.apk | |
- name: Link--Archive the encrypted link app | |
if: ${{!contains(env.curr_tag, 'video')}} | |
uses: actions/upload-artifact@v2 | |
with: | |
path: app/build/outputs/apk/tencentOfficial/release/*.apk.gpg | |
- name: Link-->Rename Release Link APK | |
if: ${{!contains(env.curr_tag, 'video')}} | |
run: | | |
APK_PATH=$(ls app/build/outputs/apk/tencentOfficial/release/*.apk.gpg) | |
cp $APK_PATH iot-link-android.apk.gpg | |
- name: Link-->Upload Release apk to Asset | |
if: ${{!contains(env.curr_tag, 'video')}} | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: iot-link-android.apk.gpg | |
asset_name: iot-link-android.apk.gpg | |
asset_content_type: application/zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Video-->Encrypt SDK Demo | |
if: ${{contains(env.curr_tag, 'video')}} | |
run: | | |
gpg --batch --passphrase "$GPG_DECRYPT_PASSPHRASE" -c sdkdemo/build/outputs/apk/release/*.apk | |
- name: Video-->Rename Release SDK Demo APK | |
if: ${{contains(env.curr_tag, 'video')}} | |
run: | | |
SDKDEMO_PATH=$(ls sdkdemo/build/outputs/apk/release/*-release.apk.gpg) | |
cp $SDKDEMO_PATH sdkdemo-release.apk.gpg | |
- name: Video-->Upload SDK Demo to Asset | |
if: ${{contains(env.curr_tag, 'video')}} | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: sdkdemo-release.apk.gpg | |
asset_name: sdkdemo-release.apk.gpg | |
asset_content_type: application/zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Video-->Deploy SDKDemo to fir | |
if: ${{contains(env.curr_tag, 'video')}} | |
run: | | |
demoApk=$(ls sdkdemo/build/outputs/apk/release/sdkdemo-release.apk) | |
rc=$(git rev-parse --short HEAD) | |
rl=$(git log --pretty=format:"%s" $rc -1) | |
fir publish $demoApk -T $IOT_FIRIM_API_TOKEN -c "$rl" --oversea_turbo --force_pin_history -V | |
env: | |
IOT_FIRIM_API_TOKEN: ${{ secrets.IOT_FIRIM_API_TOKEN }} | |
- name: Report success result to wecom | |
if: ${{ success() }} | |
run: | | |
echo success!!! | |
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} success | |
- name: Report fail result to wecom | |
if: ${{ failure() }} | |
run: | | |
echo fail!!! | |
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} fail |