Add files via upload
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,211 @@
|
||||
apply plugin: "com.android.application"
|
||||
apply plugin: "org.jetbrains.kotlin.android"
|
||||
apply plugin: "com.facebook.react"
|
||||
|
||||
import com.android.build.OutputFile
|
||||
import groovy.json.JsonSlurper
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
|
||||
/**
|
||||
* This is the configuration block to customize your React Native Android app.
|
||||
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
||||
*/
|
||||
react {
|
||||
/* Folders */
|
||||
// The root of your project, i.e. where "package.json" lives. Default is '..'
|
||||
// root = file("../")
|
||||
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
|
||||
// reactNativeDir = file("../node_modules/react-native")
|
||||
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
|
||||
// codegenDir = file("../node_modules/@react-native/codegen")
|
||||
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
|
||||
// cliFile = file("../node_modules/react-native/cli.js")
|
||||
|
||||
/* Variants */
|
||||
// The list of variants to that are debuggable. For those we're going to
|
||||
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
|
||||
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
||||
// debuggableVariants = ["liteDebug", "prodDebug"]
|
||||
|
||||
/* Bundling */
|
||||
// A list containing the node command and its flags. Default is just 'node'.
|
||||
// nodeExecutableAndArgs = ["node"]
|
||||
//
|
||||
// The command to run when bundling. By default is 'bundle'
|
||||
// bundleCommand = "ram-bundle"
|
||||
//
|
||||
// The path to the CLI configuration file. Default is empty.
|
||||
// bundleConfig = file(../rn-cli.config.js)
|
||||
//
|
||||
// The name of the generated asset file containing your JS bundle
|
||||
// bundleAssetName = "MyApplication.android.bundle"
|
||||
//
|
||||
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
||||
// entryFile = file("../js/MyApplication.android.js")
|
||||
//
|
||||
// A list of extra flags to pass to the 'bundle' commands.
|
||||
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
||||
// extraPackagerArgs = []
|
||||
|
||||
/* Hermes Commands */
|
||||
// The hermes compiler command to run. By default it is 'hermesc'
|
||||
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
||||
//
|
||||
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
||||
// hermesFlags = ["-O", "-output-source-map"]
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this to true to create four separate APKs instead of one,
|
||||
* one for each native architecture. This is useful if you don't
|
||||
* use App Bundles (https://developer.android.com/guide/app-bundle/)
|
||||
* and want to have separate APKs to upload to the Play Store.
|
||||
*/
|
||||
def enableSeparateBuildPerCPUArchitecture = true
|
||||
|
||||
/**
|
||||
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
||||
*/
|
||||
def enableProguardInReleaseBuilds = true
|
||||
|
||||
/**
|
||||
* The preferred build flavor of JavaScriptCore (JSC)
|
||||
*
|
||||
* For example, to use the international variant, you can use:
|
||||
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
||||
*
|
||||
* The international variant includes ICU i18n library and necessary data
|
||||
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
||||
* give correct results when using with locales other than en-US. Note that
|
||||
* this variant is about 6MiB larger per architecture than default.
|
||||
*/
|
||||
def jscFlavor = 'org.webkit:android-jsc:+'
|
||||
|
||||
/**
|
||||
* Private function to get the list of Native Architectures you want to build.
|
||||
* This reads the value from reactNativeArchitectures in your gradle.properties
|
||||
* file and works together with the --active-arch-only flag of react-native run-android.
|
||||
*/
|
||||
def reactNativeArchitectures() {
|
||||
def value = project.getProperties().get("reactNativeArchitectures")
|
||||
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
||||
}
|
||||
|
||||
// Get version number
|
||||
def getNpmPackageJson() {
|
||||
def inputFile = new File("../package.json")
|
||||
def packageJson = new JsonSlurper().parseText(inputFile.text)
|
||||
return packageJson
|
||||
}
|
||||
def npmPackageJson = getNpmPackageJson()
|
||||
def verCode = npmPackageJson["versionCode"]
|
||||
def verName = npmPackageJson["version"]
|
||||
def applicationName = npmPackageJson["name"]
|
||||
|
||||
android {
|
||||
ndkVersion rootProject.ext.ndkVersion
|
||||
|
||||
buildToolsVersion rootProject.ext.buildToolsVersion
|
||||
compileSdk rootProject.ext.compileSdkVersion
|
||||
|
||||
namespace "cn.toside.music.mobile"
|
||||
defaultConfig {
|
||||
applicationId "cn.toside.music.mobile"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode verCode
|
||||
versionName verName
|
||||
}
|
||||
|
||||
splits {
|
||||
abi {
|
||||
reset()
|
||||
enable enableSeparateBuildPerCPUArchitecture
|
||||
universalApk true // If true, also generate a universal APK
|
||||
include (*reactNativeArchitectures())
|
||||
}
|
||||
}
|
||||
// ==================== 彻底重写的签名配置 ====================
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile file('ikunshare.keystore')
|
||||
storePassword '@Ikun2.0.1.2'
|
||||
keyAlias 'ikunshare'
|
||||
keyPassword '@Ikun2.0.1.2'
|
||||
}
|
||||
|
||||
release {
|
||||
// 安全获取属性(变量名故意改成不和属性冲突)
|
||||
def keystoreFile = project.findProperty("FONGMIBOX_STORE_FILE") ?: ""
|
||||
def keystorePass = project.findProperty("FONGMIBOX_STORE_PASSWORD") ?: ""
|
||||
def keystoreAlias = project.findProperty("FONGMIBOX_KEY_ALIAS") ?: ""
|
||||
def keystoreKeyPass = project.findProperty("FONGMIBOX_KEY_PASSWORD") ?: ""
|
||||
|
||||
// 检查是否注入成功
|
||||
if (!keystoreFile || !keystorePass || !keystoreAlias || !keystoreKeyPass) {
|
||||
throw new GradleException("TVBoxOSC signing properties missing in android/gradle.properties! Check workflow injection.")
|
||||
}
|
||||
|
||||
// 显式赋值,避免任何 DSL 歧义
|
||||
storeFile = file(keystoreFile)
|
||||
storePassword = keystorePass
|
||||
keyAlias = keystoreAlias
|
||||
keyPassword = keystoreKeyPass
|
||||
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
enableV3Signing true
|
||||
enableV4Signing true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
release {
|
||||
signingConfig signingConfigs.release
|
||||
minifyEnabled enableProguardInReleaseBuilds
|
||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||
}
|
||||
}
|
||||
// ===========================================================
|
||||
|
||||
// applicationVariants are e.g. debug, release
|
||||
applicationVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
// For each separate APK per architecture, set a unique version code as described here:
|
||||
// https://developer.android.com/studio/build/configure-apk-splits.html
|
||||
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
|
||||
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
||||
def abi = output.getFilter(OutputFile.ABI)
|
||||
if (abi == null) { // null for the universal-debug, universal-release variants
|
||||
output.outputFileName =
|
||||
"${applicationName}-v${defaultConfig.versionName}-universal.apk"
|
||||
} else {
|
||||
output.versionCodeOverride =
|
||||
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
|
||||
output.outputFileName =
|
||||
"${applicationName}-v${defaultConfig.versionName}-${abi}.apk"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// The version of react-native is set by the React Native Gradle Plugin
|
||||
implementation("com.facebook.react:react-android")
|
||||
implementation("com.facebook.react:flipper-integration")
|
||||
// implementation "androidx.javascriptengine:javascriptengine:1.0.0-alpha07"
|
||||
// implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
|
||||
implementation 'wang.harlon.quickjs:wrapper-android:2.4.0'
|
||||
|
||||
if (hermesEnabled.toBoolean()) {
|
||||
implementation("com.facebook.react:hermes-android")
|
||||
} else {
|
||||
implementation jscFlavor
|
||||
}
|
||||
}
|
||||
|
||||
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
||||
@@ -0,0 +1,204 @@
|
||||
name: Build111
|
||||
|
||||
on:
|
||||
# push:
|
||||
# branches: [ "main" ]
|
||||
# pull_request:
|
||||
# branches: [ "main" ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
Android:
|
||||
name: Android
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out git repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Env
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Configure TVBoxOSC Signing
|
||||
run: |
|
||||
cd android
|
||||
ls -l app/TVBoxOSC.jks # 确认 keystore 存在
|
||||
|
||||
# 只写入属性即可,build.gradle 会自动识别并优先使用
|
||||
cat <<'EOF' >> gradle.properties
|
||||
FONGMIBOX_STORE_FILE=../app/TVBoxOSC.jks
|
||||
FONGMIBOX_KEY_ALIAS=TVBoxOSC
|
||||
FONGMIBOX_STORE_PASSWORD=TVBoxOSC
|
||||
FONGMIBOX_KEY_PASSWORD=TVBoxOSC
|
||||
EOF
|
||||
|
||||
- name: Build Packages
|
||||
run: |
|
||||
cd android
|
||||
chmod +x ./gradlew
|
||||
./gradlew clean assembleRelease --parallel --daemon --warning-mode all
|
||||
|
||||
# Push tag to GitHub if package.json version's tag is not tagged
|
||||
- name: Get package version
|
||||
run: |
|
||||
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
||||
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Create git tag
|
||||
uses: pkgdeps/git-tag-action@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
github_repo: ${{ github.repository }}
|
||||
version: ${{ env.PACKAGE_VERSION }}
|
||||
git_commit_sha: ${{ github.sha }}
|
||||
git_tag_prefix: "v"
|
||||
|
||||
- name: Generate file MD5
|
||||
run: |
|
||||
cd android/app/build/outputs/apk/release
|
||||
md5sum *.apk
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: ./.github/actions/upload-artifact
|
||||
env:
|
||||
PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
|
||||
|
||||
# Android_SL:
|
||||
# name: Android_SL
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Check out git repository
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# ref: statusbar_lyric
|
||||
|
||||
# - name: Setup Env
|
||||
# uses: ./.github/actions/setup
|
||||
|
||||
# - name: Build Packages
|
||||
# shell: bash
|
||||
# run: |
|
||||
# cd android
|
||||
# echo ${{ secrets.KEYSTORE_STORE_FILE_BASE64 }} | base64 --decode > app/${{ secrets.KEYSTORE_STORE_FILE }}
|
||||
# ./gradlew assembleRelease -PMYAPP_UPLOAD_STORE_FILE='${{ secrets.KEYSTORE_STORE_FILE }}' -PMYAPP_UPLOAD_KEY_ALIAS='${{ secrets.KEYSTORE_KEY_ALIAS }}' -PMYAPP_UPLOAD_STORE_PASSWORD='${{ secrets.KEYSTORE_PASSWORD }}' -PMYAPP_UPLOAD_KEY_PASSWORD='${{ secrets.KEYSTORE_KEY_PASSWORD }}'
|
||||
# rm -f app/${{ secrets.KEYSTORE_STORE_FILE }}
|
||||
|
||||
# # Push tag to GitHub if package.json version's tag is not tagged
|
||||
# - name: Get package version
|
||||
# run: |
|
||||
# node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV
|
||||
# echo "COMMIT_SHA=$(git show -s --format=%H)" >> $GITHUB_ENV
|
||||
|
||||
# - name: Create git tag
|
||||
# uses: pkgdeps/git-tag-action@v3
|
||||
# with:
|
||||
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# github_repo: ${{ github.repository }}
|
||||
# version: ${{ env.PACKAGE_VERSION }}
|
||||
# git_commit_sha: ${{ env.COMMIT_SHA }}
|
||||
# git_tag_prefix: "v"
|
||||
|
||||
# - name: Generate file MD5
|
||||
# run: |
|
||||
# echo "current commit sha: ${{ env.COMMIT_SHA }}"
|
||||
# cd android/app/build/outputs/apk/release
|
||||
# md5sum *.apk
|
||||
|
||||
# - name: Upload Artifact
|
||||
# uses: ./.github/actions/upload-artifact
|
||||
# env:
|
||||
# PACKAGE_TYPE: 'Android_SL'
|
||||
# PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
|
||||
|
||||
# Android_5:
|
||||
# name: Android_5
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Check out git repository
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# ref: android_5
|
||||
|
||||
# - name: Setup Env
|
||||
# uses: ./.github/actions/setup
|
||||
|
||||
# - name: Build Packages
|
||||
# shell: bash
|
||||
# run: |
|
||||
# cd android
|
||||
# echo ${{ secrets.KEYSTORE_STORE_FILE_BASE64 }} | base64 --decode > app/${{ secrets.KEYSTORE_STORE_FILE }}
|
||||
# ./gradlew assembleRelease -PMYAPP_UPLOAD_STORE_FILE='${{ secrets.KEYSTORE_STORE_FILE }}' -PMYAPP_UPLOAD_KEY_ALIAS='${{ secrets.KEYSTORE_KEY_ALIAS }}' -PMYAPP_UPLOAD_STORE_PASSWORD='${{ secrets.KEYSTORE_PASSWORD }}' -PMYAPP_UPLOAD_KEY_PASSWORD='${{ secrets.KEYSTORE_KEY_PASSWORD }}'
|
||||
# rm -f app/${{ secrets.KEYSTORE_STORE_FILE }}
|
||||
|
||||
# # Push tag to GitHub if package.json version's tag is not tagged
|
||||
# - name: Get package version
|
||||
# run: |
|
||||
# node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV
|
||||
# echo "COMMIT_SHA=$(git show -s --format=%H)" >> $GITHUB_ENV
|
||||
|
||||
# - name: Create git tag
|
||||
# uses: pkgdeps/git-tag-action@v3
|
||||
# with:
|
||||
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# github_repo: ${{ github.repository }}
|
||||
# version: ${{ env.PACKAGE_VERSION }}
|
||||
# git_commit_sha: ${{ env.COMMIT_SHA }}
|
||||
# git_tag_prefix: "v"
|
||||
|
||||
# - name: Generate file MD5
|
||||
# run: |
|
||||
# echo "current commit sha: ${{ env.COMMIT_SHA }}"
|
||||
# cd android/app/build/outputs/apk/release
|
||||
# md5sum *.apk
|
||||
|
||||
# - name: Upload Artifact
|
||||
# uses: ./.github/actions/upload-artifact
|
||||
# env:
|
||||
# PACKAGE_TYPE: 'Android_5'
|
||||
# PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }}
|
||||
|
||||
Release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
# needs: [Android, Android_SL]
|
||||
needs: [Android]
|
||||
steps:
|
||||
- name: Check out git repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ./artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Generate file MD5
|
||||
run: |
|
||||
echo -e '\n### File MD5\n```' >> ./publish/changeLog.md
|
||||
cd artifacts
|
||||
md5sum *.apk >> ../publish/changeLog.md
|
||||
echo -e '```\n' >> ../publish/changeLog.md
|
||||
echo -e '\n[软件安装包说明](https://lyswhut.github.io/lx-music-doc/download#%E8%BD%AF%E4%BB%B6%E5%AE%89%E8%A3%85%E5%8C%85%E8%AF%B4%E6%98%8E)\n' >> ../publish/changeLog.md
|
||||
|
||||
- name: Get package version
|
||||
run: |
|
||||
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
||||
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
body_path: ./publish/changeLog.md
|
||||
prerelease: false
|
||||
draft: false
|
||||
tag_name: v${{ env.PACKAGE_VERSION }}
|
||||
files: |
|
||||
artifacts/lx-music-mobile-v${{ env.PACKAGE_VERSION }}-arm64-v8a.apk
|
||||
artifacts/lx-music-mobile-v${{ env.PACKAGE_VERSION }}-armeabi-v7a.apk
|
||||
artifacts/lx-music-mobile-v${{ env.PACKAGE_VERSION }}-x86_64.apk
|
||||
artifacts/lx-music-mobile-v${{ env.PACKAGE_VERSION }}-x86.apk
|
||||
artifacts/lx-music-mobile-v${{ env.PACKAGE_VERSION }}-universal.apk
|
||||
|
||||
# artifacts/lx-music-mobile-v${{ env.PACKAGE_VERSION }}-sl-arm64-v8a.apk
|
||||
# artifacts/lx-music-mobile-v${{ env.PACKAGE_VERSION }}-android_5-universal.apk
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
+4
-1
@@ -1 +1,4 @@
|
||||
q
|
||||
文件放置的位置:
|
||||
android/app/build.gradle
|
||||
android/app/TVBoxOSC.jks
|
||||
.github/workflows/release.yml
|
||||
|
||||
Reference in New Issue
Block a user