From dfd9eb9507b6fbb99e8e57fc6e1453dc9b9b0739 Mon Sep 17 00:00:00 2001 From: Francisco Prieto Date: Wed, 10 Jul 2024 14:54:38 -0300 Subject: [PATCH] Release 6.9.1 (#1073) * Remove unsafe send error email for EmbraceAutomaticVerification (#1049) (cherry picked from commit 612354b495333ed3cae0d15645248b2ca6af100e) * Fix missing sdk_version reading it from gradle.properties in kts file (#1072) (cherry picked from commit e4695b069f148b847ef487cb213b5ce5f97f3e36) * Use token user and password for Sonatype publishing (#1048) ## Goal Use token user and password for publishing per [new Maven Central requirements](https://central.sonatype.org/news/20240617_migration_of_accounts/#the-impact-on-ossrh-and-the-central-publisher-portal) I generated the token user and password per instructions [here](https://central.sonatype.org/publish/generate-token/) and added them to the repo as a secret that I now reference in the workflows, which is this change. (cherry picked from commit b075f14ad238103c3fca4b48d92ce783f7ffd22e) * Consolidate release workflows --------- Co-authored-by: Nelsito Co-authored-by: Hanson Ho --- .github/workflows/build-rc-workflow.yml | 25 ++-- .github/workflows/pre-patch-workflow.yml | 113 ------------------ .github/workflows/pre-release-workflow.yml | 11 +- .github/workflows/rc-release-branch.yml | 1 - .github/workflows/rc-update-test-apps.yml | 1 - .github/workflows/release-workflow.yml | 5 +- embrace-android-sdk/build.gradle.kts | 5 +- .../EmbraceAutomaticVerification.kt | 28 ----- 8 files changed, 18 insertions(+), 171 deletions(-) delete mode 100644 .github/workflows/pre-patch-workflow.yml diff --git a/.github/workflows/build-rc-workflow.yml b/.github/workflows/build-rc-workflow.yml index 632829db65..32fef8d3ab 100644 --- a/.github/workflows/build-rc-workflow.yml +++ b/.github/workflows/build-rc-workflow.yml @@ -1,8 +1,8 @@ -name: Pre-Release - Create New Release Candidates +name: Pre-Release - Create New Release Candidate env: - SONATYPE_USERNAME: embrace-io - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_TOKEN_USER }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }} MAVEN_QA_USER: github MAVEN_QA_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} mavenSigningKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }} @@ -20,6 +20,10 @@ on: version_of_rc: description: 'Version to create new RC for. Specify only, e.g. 6.3' required: true + patch_number: + description: 'Patch number. e.g. for 6.3.1, use "1". Defaults to 0' + default: '0' + required: true jobs: release: @@ -30,17 +34,10 @@ jobs: jdk-version: [ "17" ] ndk-version: [ "21.4.7075529" ] steps: - - name: Decode Keystore - run: | - mkdir "$RUNNER_TEMP"/keystore - echo $mavenSigningKeyRingFileEncoded | base64 -di > "$RUNNER_TEMP"/keystore/2DE631C1.gpg - echo "mavenSigningKeyRingFile=$RUNNER_TEMP/keystore/2DE631C1.gpg" >> $GITHUB_ENV - - name: Configure git run: | git config --global user.name 'embrace-ci[bot]' git config --global user.email 'embrace-ci@users.noreply.github.com' - git config --global url."https://${{ secrets.CD_GITHUB_USER }}:${{ secrets.CD_GITHUB_TOKEN }}@github.com".insteadOf "https://github.com" - name: Checkout SDK uses: actions/checkout@v4 @@ -88,8 +85,8 @@ jobs: - name: Set version tag in SDK run: | - git push origin :refs/tags/${{ github.event.inputs.version_of_rc }}.0 - git tag -f ${{ github.event.inputs.version_of_rc }}.0 + git push origin :refs/tags/${{ github.event.inputs.version_of_rc }}.${{ github.event.inputs.patch_number }} + git tag -f ${{ github.event.inputs.version_of_rc }}.${{ github.event.inputs.patch_number }} git push origin --tags - name: Checkout Swazzler @@ -105,8 +102,8 @@ jobs: - name: Set version tag in Swazzler run: | - git push origin :refs/tags/${{ github.event.inputs.version_of_rc }}.0 - git tag -f ${{ github.event.inputs.version_of_rc }}.0 + git push origin :refs/tags/${{ github.event.inputs.version_of_rc }}.${{ github.event.inputs.patch_number }} + git tag -f ${{ github.event.inputs.version_of_rc }}.${{ github.event.inputs.patch_number }} git push origin --tags - name: Cleanup Gradle Cache diff --git a/.github/workflows/pre-patch-workflow.yml b/.github/workflows/pre-patch-workflow.yml deleted file mode 100644 index bca4197087..0000000000 --- a/.github/workflows/pre-patch-workflow.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: Patch - Create Release Candidate - -env: - SONATYPE_USERNAME: embrace-io - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - MAVEN_QA_USER: github - MAVEN_QA_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} - mavenSigningKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }} - mavenSigningKeyRingFileEncoded: ${{ secrets.MAVEN_ANDROID_GPG_KEY }} - mavenSigningKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }} - -on: - workflow_dispatch: - inputs: - version_to_patch: - description: 'Version to patch. Specify only, e.g. 6.3' - required: true - patch_number: - description: 'Patch number. e.g. for 6.3.1, use "1"' - default: '1' - required: true - -jobs: - release: - timeout-minutes: 60 - runs-on: ubuntu-latest - strategy: - matrix: - jdk-version: [ "17" ] - ndk-version: [ "21.4.7075529" ] - steps: - - name: Decode Keystore - run: | - mkdir "$RUNNER_TEMP"/keystore - echo $mavenSigningKeyRingFileEncoded | base64 -di > "$RUNNER_TEMP"/keystore/2DE631C1.gpg - echo "mavenSigningKeyRingFile=$RUNNER_TEMP/keystore/2DE631C1.gpg" >> $GITHUB_ENV - - - name: Configure git - run: | - git config --global user.name 'embrace-ci[bot]' - git config --global user.email 'embrace-ci@users.noreply.github.com' - git config --global url."https://${{ secrets.CD_GITHUB_USER }}:${{ secrets.CD_GITHUB_TOKEN }}@github.com".insteadOf "https://github.com" - - - name: Checkout SDK - uses: actions/checkout@v4 - with: - ref: release/${{ github.event.inputs.version_to_patch }} - token: ${{ secrets.CD_GITHUB_TOKEN }} - - - uses: actions/cache@v4 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - ~/.m2/repository - ~/.sonar/cache - key: ${{ runner.os }}-gradle-jdk${{ matrix.jdk-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle - - - name: Install JDK ${{ matrix.jdk-version }} - uses: actions/setup-java@v4 - with: - distribution: 'adopt' - java-version: ${{ matrix.jdk-version }} - - - name: Setup NDK ${{ matrix.ndk-version }} - run: | - export ANDROID_ROOT=/usr/local/lib/android - export ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk - export ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle - ln -sfn $ANDROID_SDK_ROOT/ndk/${{ matrix.ndk-version }} $ANDROID_NDK_ROOT - - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v3 - - - name: Patch Pre-Release - Publish and close Sonatype repository - run: | - sed -i -r "s#version = ([^\']+)#version = ${{ github.event.inputs.version_to_patch }}.${{ github.event.inputs.patch_number }}#" gradle.properties - git add gradle.properties - git commit -m "CI/CD: change patch version to be released: ${{ github.event.inputs.version_to_patch }}.${{ github.event.inputs.patch_number }}" - git push - ./gradlew clean check publishReleasePublicationToSonatype closeSonatypeStagingRepository -Dorg.gradle.parallel=false --stacktrace - - - name: Archive Test Results - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: android-sdk-test-results - path: embrace-android-sdk/build/reports/tests/ - - - name: Checkout Swazzler - uses: actions/checkout@v4 - with: - repository: embrace-io/embrace-swazzler3 - ref: release/${{ github.event.inputs.version_to_patch }} - token: ${{ secrets.CD_GITHUB_TOKEN }} - - - name: Swazzler Patch Pre-Release - Publish and Close repository - run: | - sed -i -r "s#version = ([^\']+)#version = ${{ github.event.inputs.version_to_patch }}.${{ github.event.inputs.patch_number }}#" gradle.properties - git add gradle.properties - git commit -m "CI/CD: change version to be released: ${{ github.event.inputs.version_to_patch }}.${{ github.event.inputs.patch_number }}" - git push - ./gradlew clean check publishToSonatype closeSonatypeStagingRepository -Dorg.gradle.parallel=false --stacktrace - - - name: Cleanup Gradle Cache - # Based on https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle#caching-dependencies - # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. - # Restoring these files from a GitHub Actions cache might cause problems for future builds. - run: | - rm -f ~/.gradle/caches/modules-2/modules-2.lock - rm -f ~/.gradle/caches/modules-2/gc.properties \ No newline at end of file diff --git a/.github/workflows/pre-release-workflow.yml b/.github/workflows/pre-release-workflow.yml index 6bd12342f2..4bc0641fd4 100644 --- a/.github/workflows/pre-release-workflow.yml +++ b/.github/workflows/pre-release-workflow.yml @@ -1,14 +1,5 @@ name: Pre-Release - Cut Release Branch and Publish Release Candidate -env: - SONATYPE_USERNAME: embrace-io - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - MAVEN_QA_USER: github - MAVEN_QA_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} - mavenSigningKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }} - mavenSigningKeyRingFileEncoded: ${{ secrets.MAVEN_ANDROID_GPG_KEY }} - mavenSigningKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }} - on: workflow_dispatch: inputs: @@ -28,7 +19,7 @@ jobs: version_to_release: ${{ github.event.inputs.version_to_release }} next_version: ${{ github.event.inputs.next_version }} - release-candate: + release-candidate: name: Create Release Candidate needs: release-branch uses: ./.github/workflows/build-rc-workflow.yml diff --git a/.github/workflows/rc-release-branch.yml b/.github/workflows/rc-release-branch.yml index 8573fe617a..7c67418acd 100644 --- a/.github/workflows/rc-release-branch.yml +++ b/.github/workflows/rc-release-branch.yml @@ -28,7 +28,6 @@ jobs: run: | git config --global user.name 'embrace-ci[bot]' git config --global user.email 'embrace-ci@users.noreply.github.com' - git config --global url."https://${{ secrets.CD_GITHUB_USER }}:${{ secrets.CD_GITHUB_TOKEN }}@github.com".insteadOf "https://github.com" - name: Checkout SDK uses: actions/checkout@v4 diff --git a/.github/workflows/rc-update-test-apps.yml b/.github/workflows/rc-update-test-apps.yml index c7f913d2b4..7c72f9080b 100644 --- a/.github/workflows/rc-update-test-apps.yml +++ b/.github/workflows/rc-update-test-apps.yml @@ -26,7 +26,6 @@ jobs: run: | git config --global user.name 'embrace-ci[bot]' git config --global user.email 'embrace-ci@users.noreply.github.com' - git config --global url."https://${{ secrets.CD_GITHUB_USER }}:${{ secrets.CD_GITHUB_TOKEN }}@github.com".insteadOf "https://github.com" - name: Checkout App uses: actions/checkout@v4 diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml index eb7a88f599..587e2fcd07 100644 --- a/.github/workflows/release-workflow.yml +++ b/.github/workflows/release-workflow.yml @@ -1,8 +1,8 @@ name: Release - Release RC and Update Documentation env: - SONATYPE_USERNAME: embrace-io - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_TOKEN_USER }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }} MAVEN_QA_USER: github MAVEN_QA_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} mavenSigningKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }} @@ -56,7 +56,6 @@ jobs: run: | git config --global user.name 'embrace-ci[bot]' git config --global user.email 'embrace-ci@users.noreply.github.com' - git config --global url."https://${{ secrets.CD_GITHUB_USER }}:${{ secrets.CD_GITHUB_TOKEN }}@github.com".insteadOf "https://github.com" - name: Publish gh-pages run: | diff --git a/embrace-android-sdk/build.gradle.kts b/embrace-android-sdk/build.gradle.kts index 70a94802af..798724be74 100644 --- a/embrace-android-sdk/build.gradle.kts +++ b/embrace-android-sdk/build.gradle.kts @@ -11,6 +11,9 @@ plugins { description = "Embrace Android SDK: Core" +val version: String by project + + android { useLibrary("android.test.runner") useLibrary("android.test.base") @@ -24,7 +27,7 @@ android { // For library projects only, the BuildConfig.VERSION_NAME and BuildConfig.VERSION_CODE properties have been removed from the generated BuildConfig class // // https://developer.android.com/studio/releases/gradle-plugin#version_properties_removed_from_buildconfig_class_in_library_projects - buildConfigField("String", "VERSION_NAME", "\"${defaultConfig.versionName}\"") + buildConfigField("String", "VERSION_NAME", "\"${version}\"") buildConfigField("String", "VERSION_CODE", "\"${53}\"") } diff --git a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/EmbraceAutomaticVerification.kt b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/EmbraceAutomaticVerification.kt index 6f57b0b65e..13c51cc9c5 100644 --- a/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/EmbraceAutomaticVerification.kt +++ b/embrace-android-sdk/src/main/java/io/embrace/android/embracesdk/EmbraceAutomaticVerification.kt @@ -4,7 +4,6 @@ import android.app.Activity import android.app.AlertDialog import android.content.Context import android.content.Intent -import android.net.Uri import android.os.Handler import android.os.Looper import android.widget.Toast @@ -54,7 +53,6 @@ internal class EmbraceAutomaticVerification( companion object { internal const val TAG = "[EmbraceVerification]" private const val ON_FOREGROUND_DELAY = 5000L - private const val EMBRACE_CONTACT_EMAIL = "support@embrace.io" private const val VERIFY_INTEGRATION_DELAY = 200L private const val ON_FOREGROUND_TIMEOUT = 5000L internal val instance = EmbraceAutomaticVerification() @@ -292,10 +290,6 @@ internal class EmbraceAutomaticVerification( .setTitle(activity.getString(R.string.automatic_verification_error_title)) .setMessage(errorString) .setCancelable(true) - .setNegativeButton(activity.getString(R.string.send_error_log)) { dialog, _ -> - sendErrorLog(activity, errorString) - dialog.dismiss() - } .setPositiveButton(activity.getString(R.string.close)) { dialog, _ -> dialog.dismiss() } @@ -305,28 +299,6 @@ internal class EmbraceAutomaticVerification( } } - private fun sendErrorLog(activity: Activity, errorMessage: String) { - val errorLog = generateErrorLog(errorMessage) - val selectorIntent = Intent(Intent.ACTION_SENDTO).setData(Uri.parse("mailto:$EMBRACE_CONTACT_EMAIL")) - - val emailIntent = Intent(Intent.ACTION_SEND).apply { - putExtra(Intent.EXTRA_EMAIL, arrayOf(EMBRACE_CONTACT_EMAIL)) - putExtra(Intent.EXTRA_SUBJECT, "Android Verification Log") - putExtra(Intent.EXTRA_TEXT, errorLog) - selector = selectorIntent - } - - activity.startActivity(Intent.createChooser(emailIntent, "Send Email")) - } - - private fun generateErrorLog(errorMessage: String): String { - var errorLog = "App ID: ${Embrace.getImpl().metadataService?.getAppId()}\n" + - "App Version: ${Embrace.getImpl().metadataService?.getAppVersionName()}" - errorLog += "\n\n-----------------\n\n" - errorLog += errorMessage - return errorLog - } - private fun logInfo(message: String) { Embrace.getInstance().internalInterface.logInfo("$TAG $message", null) }