diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f9ae0d66..4812d6b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Android CI +name: Build, Deploy on: push: @@ -23,17 +23,49 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Decrypt keystore + env: + RELEASE_ENCRYPT_SECRET_KEY: ${{ secrets.RELEASE_ENCRYPT_SECRET_KEY }} + run: openssl aes-256-cbc -d -in "${{ github.workspace }}/${{ vars.RELEASE_KEYSTORE }}.encrypted" -k $RELEASE_ENCRYPT_SECRET_KEY -md md5 >> ${{ github.workspace }}/${{ vars.RELEASE_KEYSTORE }} + + - name: Generate keystore.properties + env: + RELEASE_KEY_PASSWORD: ${{ secrets.RELEASEKEYPASSWORD }} + RELEASE_STORE_PASSWORD: ${{ secrets.RELEASESTOREPASSWORD }} + run: printf 'releaseKeyAlias=%s\nreleaseKeyPassword=%s\nreleaseKeyStore=%s\nreleaseStorePassword=%s' ${{ vars.RELEASE_KEY_ALIAS }} $RELEASE_KEY_PASSWORD ${{ vars.RELEASE_KEYSTORE }} $RELEASE_STORE_PASSWORD > ${{ github.workspace }}/keystore.properties + - name: Build with Gradle - run: ./gradlew packageRelease + run: ./gradlew clean packageRelease - name: Upload Package uses: actions/upload-artifact@v3.1.2 with: name: package - path: ${{ github.workspace }}/build/outputs/apk/release/*.apk + path: ${{ github.workspace }}/app/build/outputs/apk/release/*.apk - name: Upload Mapping uses: actions/upload-artifact@v3.1.2 with: name: mapping - path: ${{ github.workspace }}/build/outputs/apk/mapping \ No newline at end of file + path: ${{ github.workspace }}/app/build/outputs/mapping/release + + - name: Upload Mapping to App Center + uses: vhsantos26/app-center-cli-action@v1 + with: + user_token: ${{ secrets.APP_CENTER_TOKEN }} + command: appcenter crashes upload-mappings + + - name: Get Output Metadata + run: | + echo 'OUTPUT_METADATA<> $GITHUB_ENV + cat ${{ github.workspace }}/app/build/outputs/apk/release/output-metadata.json >> $GITHUB_ENV + echo 'OUTPUT_METADATA_DELIMITER' >> $GITHUB_ENV + + - name: Upload Mapping to App Center + env: + version_code: ${{ fromJSON(env.OUTPUT_METADATA).elements[0].versionCode }} + version_name: ${{ fromJSON(env.OUTPUT_METADATA).elements[0].versionName }} + uses: vhsantos26/app-center-cli-action@v1 + with: + user_token: ${{ secrets.APP_CENTER_TOKEN }} + command: appcenter crashes upload-mappings -c $version_code -n $version_name -m ${{ github.workspace }}/app/build/outputs/apk/mapping/mapping.txt -a huanchengfly/TiebaLite \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 22e4fa9e..8a3281e8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,13 +13,14 @@ def keystoreProperties = new Properties() keystoreProperties.load(new FileInputStream(rootProject.file("keystore.properties"))) def applicationProperties = new Properties() applicationProperties.load(new FileInputStream(rootProject.file("application.properties"))) -def buildId = System.getenv("APPCENTER_BUILD_ID") -def isSelfBuild = buildId == null +def sha = System.getenv("GITHUB_SHA") +def isCI = System.getenv("CI") +def isSelfBuild = isCI != "true" def applicationVersionCode = applicationProperties["versionCode"].toInteger() def applicationVersionName = applicationProperties["versionName"] def isPerVersion = applicationProperties["isPerRelease"] == "true" if (!isSelfBuild) { - applicationVersionName = applicationVersionName + ".${buildId}" + applicationVersionName = applicationVersionName + ".${sha.substring(0, 7)}" } if (isPerVersion) { applicationVersionName = applicationVersionName + ".${applicationProperties["preReleaseName"]}-${applicationProperties["preReleaseVer"]}" @@ -146,7 +147,7 @@ dependencies { implementation "com.google.accompanist:accompanist-swiperefresh:$accompanist_version" implementation "com.google.accompanist:accompanist-webview:$accompanist_version" - def sketch_version = "3.2.0-beta01" + def sketch_version = "3.2.0-beta02" implementation "io.github.panpf.sketch3:sketch:$sketch_version" implementation "io.github.panpf.sketch3:sketch-compose:$sketch_version" implementation "io.github.panpf.sketch3:sketch-extensions:$sketch_version" @@ -193,7 +194,7 @@ dependencies { implementation fileTree(include: ["*.jar"], dir: "libs") //AndroidX - implementation "androidx.appcompat:appcompat:1.5.1" + implementation "androidx.appcompat:appcompat:1.6.0" implementation "androidx.annotation:annotation:1.5.0" implementation "androidx.constraintlayout:constraintlayout:2.1.4" implementation "androidx.core:core-ktx:1.9.0"