Files
TVbox-interface/蜂蜜TV自己打包/Multi-Branch已完美打包release.yml
T

81 lines
2.8 KiB
YAML

name: fongmi Build
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Fix invalid plugins block syntax
run: |
find . -name "build.gradle" -exec sed -i \
-e "s/id\(.*\)version *= */id\1version /g" \
{} +
- name: Fix deprecated Gradle syntax
run: |
find . -name "*.gradle" -exec sed -i \
-e 's/\bnamespace\( \+\)/namespace = /g' \
-e 's/\burl\( \+\)/url = /g' \
-e 's/\bbuildConfig\( \+\)/buildConfig = /g' \
-e 's/\bviewBinding\( \+\)/viewBinding = /g' \
-e 's/\bshrinkResources\( \+\)/shrinkResources = /g' \
-e 's/\buseLegacyPackaging\( \+\)/useLegacyPackaging = /g' \
-e 's/\bcoreLibraryDesugaringEnabled\( \+\)/coreLibraryDesugaringEnabled = /g' \
-e 's/\bversion\( \+\)/version = /g' \
{} +
- name: Add signing config
run: |
signingConfigs='signingConfigs {
if (project.hasProperty("FONGMIBOX_STORE_FILE")) {
release {
storeFile file(FONGMIBOX_STORE_FILE)
storePassword FONGMIBOX_STORE_PASSWORD
keyAlias FONGMIBOX_KEY_ALIAS
keyPassword FONGMIBOX_KEY_PASSWORD
v1SigningEnabled true
v2SigningEnabled true
enableV3Signing = true
enableV4Signing = true
}
}
}'
signingConfig='signingConfig signingConfigs.release'
sed -i "/android {/a\\$signingConfigs" app/build.gradle
sed -i "/release {/a\\$signingConfig" app/build.gradle
cp -f ${{ github.workspace }}/.github/workflows/TVBoxOSC.jks app/TVBoxOSC.jks
echo "FONGMIBOX_STORE_FILE=./TVBoxOSC.jks" >> ./gradle.properties
echo "FONGMIBOX_KEY_ALIAS=TVBoxOSC" >> ./gradle.properties
echo "FONGMIBOX_STORE_PASSWORD=TVBoxOSC" >> ./gradle.properties
echo "FONGMIBOX_KEY_PASSWORD=TVBoxOSC" >> ./gradle.properties
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew clean assembleRelease --parallel --warning-mode all --stacktrace
- name: Prepare APK
run: |
mkdir -p ${{ github.workspace }}/apk/
find . -name "*.apk" -exec mv {} ${{ github.workspace }}/apk/ \;
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: com.github.tvbox.fongmi
path: ${{ github.workspace }}/apk/*