123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- name: QBox_build
- on:
-
- workflow_dispatch:
- jobs:
- build:
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- include:
- - userName: q215613905
- repoName: TVBoxOS
- branchName: main
- appName: QBox
- osName: qb
-
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
- - name: Check New Commit
- run: |
- upStream=https://github.com/${{ matrix.userName }}/${{ matrix.repoName }}
- echo "upStream=$upStream" >> $GITHUB_ENV
- commit=$(curl -sL $upStream/commits/${{ matrix.branchName }} |grep -o "/${{ matrix.userName }}/${{ matrix.repoName }}/commit/[a-z0-9]\+" |head -1 | cut -d\/ -f5)
- if ! grep -q "$commit" README.md || [ "${{ inputs.rebuild }}" == "true" ]; then
- echo "commit=$commit" >> $GITHUB_ENV
- echo "commitS=${commit:0:7}" >> $GITHUB_ENV
- fi
-
- - name: Checkout Source Code
- if: ${{ env.commit }}
- run: |
- git clone ${{ env.upStream }} ${{ matrix.repoName }}
- cd ${{ matrix.repoName }}
- git checkout ${{ env.commit }}
- echo "tag=$(git log --date=format:'%Y%m%d-%H%M' --pretty=format:%cd ${{ env.commitS }} -1)" >> $GITHUB_ENV
-
- - name: DIY PY
- if: ${{ env.commit }}
- working-directory: ${{ matrix.repoName }}
- run: |
- chmod +x ${{ github.workspace }}/DIY/py.sh
- bash ${{ github.workspace }}/DIY/py.sh
-
- - name: DIY
- if: ${{ env.commit }}
- working-directory: ${{ matrix.repoName }}
- run: |
- cp -rf $GITHUB_WORKSPACE/DIY/png/图标6.png app/src/main/res/drawable-hdpi/app_icon.png
- cp -rf $GITHUB_WORKSPACE/DIY/png/图标6.png app/src/main/res/drawable-xhdpi/app_icon.png
- cp -rf $GITHUB_WORKSPACE/DIY/png/图标6.png app/src/main/res/drawable-xxhdpi/app_icon.png
- cp -rf $GITHUB_WORKSPACE/DIY/png/图标6.png app/src/main/res/drawable-xxxhdpi/app_icon.png
- cp -rf $GITHUB_WORKSPACE/DIY/png/app_bg.png app/src/main/res/drawable/app_bg.png
- sed -i 's%播放器 % %g' app/src/main/java/com/github/tvbox/osc/util/PlayerHelper.java
- sed -i 's%android:layout_width="@dimen%vs_560"%g' app/src/main/res/values/dimens.xml
- sed -i 's%6000%5000%g' app/src/main/java/com/github/tvbox/osc/player/controller/VodController.java
- sed -i 's%380+200*spanCount%680+600*spanCount%g' app/src/main/java/com/github/tvbox/osc/ui/activity/HomeActivity.java
- sed -i 's%spanCount+1%spanCount%g' app/src/main/java/com/github/tvbox/osc/ui/activity/HomeActivity.java
- sed -i 's%color_BBFFFFFF%color_FFFFFF%g' app/src/main/res/layout/item_home_sort.xml
- sed -i 's%color_BBFFFFFF%color_FFFFFF%g' app/src/main/java/com/github/tvbox/osc/ui/activity/HomeActivity.java
- sed -i 's%com.github.tvbox.osc%com.github.tvbox.osc.${{ matrix.osName }}%g' app/build.gradle
- sed -i 's%TVBox%追剧TV%g' app/src/main/res/values/strings.xml
- sed -i 's%(HawkConfig.API_URL, "");%(HawkConfig.API_URL, "https://agit.ai/wwz09/ubuntu/raw/branch/master/main.json");%g' app/src/main/java/com/github/tvbox/osc/api/ApiConfig.java
- sed -i 's%Hawk.put(HawkConfig.PLAY_TYPE, 1);%Hawk.put(HawkConfig.HOME_REC, 1); // Home Rec 0=豆瓣, 1=推荐, 2=历史\n Hawk.put(HawkConfig.PLAY_TYPE, 1); // Player 0=系统, 1=IJK, 2=Exo\n Hawk.put(HawkConfig.IJK_CODEC, "硬解码");// IJK Render 软解码, 硬解码\n %g' app/src/main/java/com/github/tvbox/osc/base/App.java
-
-
- - name: Extra Modify
- if: ${{ env.commit }}
- working-directory: ${{ matrix.repoName }}
- run: |
- echo '修改VersionName'
- sed -i "/versionName/s#[0-9a-zA-Z_\.\'\"-]\+\$#\'${{ env.tag }}\'#" app/build.gradle
- sed -i "/android:text=/s#=\"#=\"${{ env.tag }}\\\\n\\\\n#" app/src/main/res/layout/dialog_about.xml
- echo 'crosswalk源,防挂'
- if grep -q 'crosswalk' build.gradle; then
- sed -i "/crosswalk/a\ maven { url 'https://o0halflife0o.github.io/crosswalk/releases/crosswalk/android/maven2' }" build.gradle
- else
- sed -i "/jitpack.io/a\ maven { url 'https://o0halflife0o.github.io/crosswalk/releases/crosswalk/android/maven2' }" build.gradle
- fi
- - name: Option For Test
- if: ${{ inputs.testOption }}
- working-directory: ${{ matrix.repoName }}
- run: |
- #添加arm64支持,不支持ijk解码
- sed -i "/armeabi-v7a[\'\"]$/s#\$#, 'arm64-v8a'#" app/build.gradle
- sed -i "/armeabi-v7a[\'\"]$/s#\$#, 'arm64-v8a'#" player/build.gradle
- - name: Release Apk Sign
- if: ${{ env.commit }}
- working-directory: ${{ matrix.repoName }}
- run: |
- signingConfigs='ICAgIHNpZ25pbmdDb25maWdzIHtcCiAgICAgICAgaWYgKHByb2plY3QuaGFzUHJvcGVydHkoIlJFTEVBU0VfU1RPUkVfRklMRSIpKSB7XAogICAgICAgICAgICBteUNvbmZpZyB7XAogICAgICAgICAgICAgICAgc3RvcmVGaWxlIGZpbGUoUkVMRUFTRV9TVE9SRV9GSUxFKVwKICAgICAgICAgICAgICAgIHN0b3JlUGFzc3dvcmQgUkVMRUFTRV9TVE9SRV9QQVNTV09SRFwKICAgICAgICAgICAgICAgIGtleUFsaWFzIFJFTEVBU0VfS0VZX0FMSUFTXAogICAgICAgICAgICAgICAga2V5UGFzc3dvcmQgUkVMRUFTRV9LRVlfUEFTU1dPUkRcCiAgICAgICAgICAgICAgICB2MVNpZ25pbmdFbmFibGVkIHRydWVcCiAgICAgICAgICAgICAgICB2MlNpZ25pbmdFbmFibGVkIHRydWVcCiAgICAgICAgICAgICAgICBlbmFibGVWM1NpZ25pbmcgPSB0cnVlXAogICAgICAgICAgICAgICAgZW5hYmxlVjRTaWduaW5nID0gdHJ1ZVwKICAgICAgICAgICAgfVwKICAgICAgICB9XAogICAgfVwKXA=='
- signingConfig='ICAgICAgICAgICAgaWYgKHByb2plY3QuaGFzUHJvcGVydHkoIlJFTEVBU0VfU1RPUkVfRklMRSIpKSB7XAogICAgICAgICAgICAgICAgc2lnbmluZ0NvbmZpZyBzaWduaW5nQ29uZmlncy5teUNvbmZpZ1wKICAgICAgICAgICAgfVwK'
- signingConfigs="$(echo "$signingConfigs" |base64 -d )"
- signingConfig="$(echo "$signingConfig" |base64 -d )"
- sed -i -e "/defaultConfig {/i\\$signingConfigs " -e "/debug {/a\\$signingConfig " -e "/release {/a\\$signingConfig " app/build.gradle
- cp -f ${{ github.workspace }}/.github/workflows/TVBoxOSC.jks app/TVBoxOSC.jks
- sed -i '$a\RELEASE_STORE_FILE=./TVBoxOSC.jks' ./gradle.properties
- sed -i '$a\RELEASE_KEY_ALIAS=TVBoxOSC' ./gradle.properties
- sed -i '$a\RELEASE_STORE_PASSWORD=TVBoxOSC' ./gradle.properties
- sed -i '$a\RELEASE_KEY_PASSWORD=TVBoxOSC' ./gradle.properties
-
- - name: Setup Gradle
- if: ${{ env.commit }}
- uses: gradle/gradle-build-action@v2
-
- - name: Build With Gradle
- if: ${{ env.commit }}
- working-directory: ${{ matrix.repoName }}
- run: |
- chmod +x gradlew
- ./gradlew assemblerelease --build-cache --parallel --daemon --warning-mode all
-
- - name: Prepare App
- if: ${{ env.commit }}
- working-directory: ${{ matrix.repoName }}
- run: |
- rm -rf apk/
- mkdir -p apk/
- for file in `find ~ -name "*.apk" -print`; do
- mv "$file" apk/${{ matrix.userName }}_${{ matrix.appName }}_${{ env.tag }}.apk
- done
-
- - name: Upload App To Artifact
- uses: actions/upload-artifact@v3
- if: ${{ env.commit }}
- with:
- name: ${{ matrix.appName }}
- path: ${{ matrix.repoName }}/apk/*
-
- - name: Whether Or Not to Publish
- if: ${{ inputs.donotpublish && env.commit }}
- run: |
- echo "commit=" >> $GITHUB_ENV
-
- - name: Release and Upload Assets
- uses: ncipollo/release-action@v1
- if: ${{ env.commit }}
- with:
- name: ${{ env.tag }}
- tag: ${{ env.tag }}
- allowUpdates: true
- removeArtifacts: true
- artifacts: |
- ${{ matrix.repoName }}/apk/*.apk
-
-
-
|