chore(CI): 无签名时使用 debug 签名

This commit is contained in:
HuanCheng65 2024-02-02 19:13:55 +08:00
parent 66fa59a560
commit be3ae43602
No known key found for this signature in database
GPG Key ID: 5EC9DD60A32C7360
3 changed files with 16 additions and 21 deletions

View File

@ -30,10 +30,10 @@ jobs:
if: ${{ github.event_name != 'pull_request' || github.ref_type == 'tag' }} if: ${{ github.event_name != 'pull_request' || github.ref_type == 'tag' }}
run: | run: |
if [ -n "${{ secrets.RELEASEKEYPASSWORD }}" ]; then if [ -n "${{ secrets.RELEASEKEYPASSWORD }}" ]; then
echo releaseKeyAlias="${{ vars.RELEASE_KEY_ALIAS }}" >> keystore.properties echo keystore.file="${{ vars.RELEASE_KEYSTORE }}" >> keystore.properties
echo releaseKeyPassword="${{ secrets.RELEASEKEYPASSWORD }}" >> keystore.properties echo keystore.password="${{ secrets.RELEASESTOREPASSWORD }}" >> keystore.properties
echo releaseKeyStore="${{ vars.RELEASE_KEYSTORE }}" >> keystore.properties echo keystore.key.alias="${{ vars.RELEASE_KEY_ALIAS }}" >> keystore.properties
echo releaseStorePassword="${{ secrets.RELEASESTOREPASSWORD }}" >> keystore.properties echo keystore.key.password="${{ secrets.RELEASEKEYPASSWORD }}" >> keystore.properties
fi fi
- name: Setup Gradle - name: Setup Gradle
@ -43,7 +43,7 @@ jobs:
cache-read-only: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/4.0-dev' }} cache-read-only: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/4.0-dev' }}
- name: Build with Gradle - name: Build with Gradle
run: ./gradlew assemble run: ./gradlew assembleRelease
- name: Read Output Metadata - name: Read Output Metadata
id: read_output_metadata id: read_output_metadata
@ -61,15 +61,6 @@ jobs:
name: "release-${{ env.version_name }}(${{ env.version_code }})" name: "release-${{ env.version_name }}(${{ env.version_code }})"
path: ./app/build/outputs/apk/release path: ./app/build/outputs/apk/release
- name: Upload Debug Package
env:
version_code: ${{ fromJSON(steps.read_output_metadata.outputs.content).elements[0].versionCode }}
version_name: ${{ fromJSON(steps.read_output_metadata.outputs.content).elements[0].versionName }}
uses: actions/upload-artifact@v3
with:
name: "debug-${{ env.version_name }}(${{ env.version_code }})"
path: ./app/build/outputs/apk/debug
- name: Upload Mapping - name: Upload Mapping
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@ -107,4 +98,4 @@ jobs:
uses: saurav-aggarwal/appcenter-cli-action@1.0.1 uses: saurav-aggarwal/appcenter-cli-action@1.0.1
with: with:
token: ${{ secrets.APP_CENTER_TOKEN }} token: ${{ secrets.APP_CENTER_TOKEN }}
command: appcenter crashes upload-mappings -c ${{ env.version_code }} -n ${{ env.version_name }} -m ${{ github.workspace }}/app/build/outputs/mapping/release/mapping.txt -a ${{ secrets.APP_CENTER_APP }} command: appcenter crashes upload-mappings -c ${{ env.version_code }} -n ${{ env.version_name }} -m /github/workspace/app/build/outputs/mapping/release/mapping.txt -a huanchengfly/TiebaLite

View File

@ -54,12 +54,13 @@ android {
compose = true compose = true
} }
signingConfigs { signingConfigs {
if (property.releaseKeyStore.isNotEmpty()) { println("keystore.file: ${property.keystore.file}")
if (property.keystore.file.isNotBlank()) {
val config by creating { val config by creating {
keyAlias = property.releaseKeyAlias storeFile = file(File(rootDir, property.keystore.file))
keyPassword = property.releaseKeyPassword storePassword = property.keystore.password
storeFile = file(File(rootDir, property.releaseKeyStore)) keyAlias = property.keystore.key.alias
storePassword = property.releaseStorePassword keyPassword = property.keystore.key.password
enableV3Signing = true enableV3Signing = true
enableV4Signing = true enableV4Signing = true
} }

View File

@ -26,7 +26,10 @@ sweetProperty {
isAddDefault = true isAddDefault = true
) )
permanentKeyValues( permanentKeyValues(
"releaseKeyStore" to "" "keystore.file" to "",
"keystore.password" to "",
"keystore.key.alias" to "",
"keystore.key.password" to ""
) )
generateFrom(CURRENT_PROJECT, ROOT_PROJECT) generateFrom(CURRENT_PROJECT, ROOT_PROJECT)
} }