diff --git a/.github/bash_scripts/pre_release.sh b/.github/bash_scripts/pre_release.sh new file mode 100644 index 0000000..fdd9df6 --- /dev/null +++ b/.github/bash_scripts/pre_release.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +appsflyerversion=$1 +rc=$2 + +sed -E -i '' "s/(.*af-android-sdk:)([0-9]+\.[0-9]+\.[0-9]+)'/\1$appsflyerversion\'/g" app/build.gradle + +sed -E -i '' "s/(.*af-android-sdk:)([0-9]+\.[0-9]+\.[0-9]+)'/\1$appsflyerversion\'/g" segmenttestapp/build.gradle + +version_code=$(grep -E 'VERSION_CODE=([0-9]+)' gradle.properties | grep -o '[0-9]\+') +version_code=$((version_code+1)) +sed -E -i '' "s/VERSION_CODE=([0-9]+)/VERSION_CODE=$version_code/g" gradle.properties + +sed -E -i '' "s/VERSION_NAME=([0-9]+\.[0-9]+\.[0-9]+)/VERSION_NAME=$appsflyerversion-rc$rc/g" gradle.properties + +sed -E -i '' "s/(POM_ARTIFACT_ID=.*)/\1-beta/g" gradle.properties + +sed -E -i '' "s/(Built with AppsFlyer Android SDK.*)([0-9]+\.[0-9]+\.[0-9]+)(.*)/\1$appsflyerversion\3/g" Readme.md +sed -E -i '' "s/(.*appsflyer:segment-android-integration:)([0-9]+\.[0-9]+\.[0-9]+)(.*)/\1$appsflyerversion\3/g" Readme.md + +sed -E -i '' "s/(.*setPluginInfo.*)([0-9]+\.[0-9]+\.[0-9]+)(.*)/\1$appsflyerversion\3/g" app/src/main/java/com/segment/analytics/android/integrations/appsflyer/AppsflyerIntegration.java + +touch "releasenotes.$appsflyerversion" diff --git a/.github/bash_scripts/release.sh b/.github/bash_scripts/release.sh new file mode 100644 index 0000000..7145aa5 --- /dev/null +++ b/.github/bash_scripts/release.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +releaseversion=$1 + +sed -i '' 's/^/* /' "releasenotes.$releaseversion" +NEW_VERSION_RELEASE_NOTES=$(cat "releasenotes.$releaseversion") +NEW_VERSION_SECTION="### $releaseversion\n$NEW_VERSION_RELEASE_NOTES\n\n" +echo -e "$NEW_VERSION_SECTION$(cat RELEASENOTES.md)" > RELEASENOTES.md + +rm -r "releasenotes.$releaseversion" + +sed -E -i '' "s/VERSION_NAME=([0-9]+\.[0-9]+\.[0-9]+).*/VERSION_NAME=$releaseversion/g" gradle.properties + +sed -E -i '' "s/(POM_ARTIFACT_ID=.*)-beta/\1/g" gradle.properties \ No newline at end of file diff --git a/.github/workflows/prepare-for-QA-release.yml b/.github/workflows/prepare-for-QA-release.yml new file mode 100644 index 0000000..edfcfea --- /dev/null +++ b/.github/workflows/prepare-for-QA-release.yml @@ -0,0 +1,51 @@ +name: pre-release + +on: + workflow_call: + +jobs: + Change-HardCoded-Version: + name: Pre Release + runs-on: + - self-hosted + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Determine release tag and release branch + run: | + TAG=$(echo "${{github.ref_name}}" | grep -Eo '[0-9]+.[0-9]+.[0-9]+') + RC=$(echo "${{github.ref_name}}" | grep -Eo '[0-9]+$') + echo "PLUGIN_VERSION=$TAG" >> $GITHUB_ENV + echo "RC_NUMBER=$RC" >> $GITHUB_ENV + - name: run script + run: bash .github/bash_scripts/pre_release.sh ${{env.PLUGIN_VERSION}} ${{env.RC_NUMBER}} + - name: Commit changes + uses: EndBug/add-and-commit@v9 + with: + author_name: Moris Gateno + author_email: moris.gateno@appsflyer.com + message: 'Commited from github action - prepaing the repo for QA.' + add: '.' + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: '11' + - name: Grant execute permission for gradlew + run: | + chmod +x ./gradlew + - name: Publish package to QA (-Beta) + run: | + ./gradlew publish + - name: Notify with Slack + uses: slackapi/slack-github-action@v1.23.0 + with: + payload: | + { + "appsflyer_version": "${{env.PLUGIN_VERSION}}", + "environment": "QA" + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.CI_SLACK_WEBHOOK_URL }} + + diff --git a/.github/workflows/prepare-for-release-workflow.yml b/.github/workflows/prepare-for-release-workflow.yml new file mode 100644 index 0000000..a653625 --- /dev/null +++ b/.github/workflows/prepare-for-release-workflow.yml @@ -0,0 +1,35 @@ +name: Prepare plugin for production + +on: + pull_request: + types: + - opened + branches: + - 'master' +# - 'dev/add-release-workflow' + +jobs: + Prepare-Plugin-For-Production: + if: startsWith(github.head_ref, 'releases/') + name: Prepare for production after testing the plugin + runs-on: + - self-hosted + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: PR branch check + uses: mdecoleman/pr-branch-name@1.2.0 + id: vars + with: + repo-token: ${{ secrets.CI_GITHUB_TOKEN }} + - name: Determine release tag and release branch + run: | + TAG=$(echo "${{ steps.vars.outputs.branch }}" | grep -Eo '[0-9]+.[0-9]+.[0-9]+') + echo "PLUGIN_VERSION=$TAG" >> $GITHUB_ENV + - name: run script + run: bash .github/bash_scripts/release.sh ${{env.PLUGIN_VERSION}} + - name: Commit and Push + run : | + git add . + git commit -m"Commited from github action - prepaing the repo for production." + git push origin HEAD:${{ steps.vars.outputs.branch }} --force \ No newline at end of file diff --git a/.github/workflows/release-QA-workflow.yml b/.github/workflows/release-QA-workflow.yml new file mode 100644 index 0000000..f7af368 --- /dev/null +++ b/.github/workflows/release-QA-workflow.yml @@ -0,0 +1,34 @@ + +name: Release plugin to QA + +on: + push: + branches: + - releases/[0-9]+.x.x/[0-9]+.[0-9]+.x/[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + +jobs: + Check-If-ReleaseNotes-Pushed: + runs-on: + - self-hosted + outputs: + answer: ${{ steps.filter.outputs.releasenotesfile }} + steps: + - uses: actions/checkout@v2 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + releasenotesfile: + - 'releasenotes.**' + + Run-Unit-Tests: + needs: Check-If-ReleaseNotes-Pushed + if: needs.Check-If-ReleaseNotes-Pushed.outputs.answer == 'false' + uses: ./.github/workflows/unit-tests-workflow.yml + secrets: inherit + + Deploy-Locally-To-QA: + needs: [Run-Unit-Tests,Check-If-ReleaseNotes-Pushed] + if: needs.Check-If-ReleaseNotes-Pushed.outputs.answer == 'false' + uses: ./.github/workflows/prepare-for-QA-release.yml + secrets: inherit diff --git a/.github/workflows/release-production-workflow.yml b/.github/workflows/release-production-workflow.yml new file mode 100644 index 0000000..e19e5d4 --- /dev/null +++ b/.github/workflows/release-production-workflow.yml @@ -0,0 +1,68 @@ +name: Release plugin to production + +on: + pull_request: + types: + - closed + branches: + - 'master' +# - 'dev/add-release-workflow' + +jobs: + Deploy-To-Production: + if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/') + runs-on: + - self-hosted + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: PR branch check + uses: mdecoleman/pr-branch-name@1.2.0 + id: vars + with: + repo-token: ${{ secrets.CI_GITHUB_TOKEN }} + - name: Determine release tag and release branch + run: | + TAG=$(echo "${{ steps.vars.outputs.branch }}" | grep -Eo '[0-9]+.[0-9]+.[0-9]+') + echo "PLUGIN_VERSION=$TAG" >> $GITHUB_ENV + echo "RELEASE_BRANCH_NAME=${{ steps.vars.outputs.branch }}" >> $GITHUB_ENV + echo "push new release >> $TAG" + - name: Create release and tag + env: + TAG: ${{env.PLUGIN_VERSION}} + uses: "actions/github-script@v5" + with: + script: | + try { + await github.rest.repos.createRelease({ + draft: false, + generate_release_notes: false, + name: process.env.TAG, + owner: context.repo.owner, + prerelease: false, + repo: context.repo.repo, + tag_name: process.env.TAG + }); + } catch (error) { + core.setFailed(error.message); + } + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: '11' + - name: Grant execute permission for gradlew + run: | + chmod +x ./gradlew + - name: Publish package + run: | + ./gradlew publish + - name: Notify with Slack + uses: slackapi/slack-github-action@v1.23.0 + with: + payload: | + { + "appsflyer_version": "${{env.PLUGIN_VERSION}}", + "environment": "Production" + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.CI_SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/unit-tests-workflow.yml similarity index 91% rename from .github/workflows/test.yml rename to .github/workflows/unit-tests-workflow.yml index 977ded4..bcc35e6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/unit-tests-workflow.yml @@ -2,11 +2,13 @@ name: CI - Tests on: push: branches-ignore: - - 'main' + - 'master' - 'releases/**' + workflow_call: jobs: Tests: - runs-on: ubuntu-latest + runs-on: + - self-hosted steps: - uses: actions/checkout@v2 - name: Set up JDK diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 4677e18..8198683 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,4 +1,6 @@ -# Release Notes +### 6.10.3 +* * Update Android SDK to v6.10.1 +* * Added CI-CD pipeline ### 6.10.2 * Update Android SDK to v6.10.2 diff --git a/Readme.md b/Readme.md index b9037bf..8dd7ba6 100644 --- a/Readme.md +++ b/Readme.md @@ -21,7 +21,7 @@ You can track installs, updates and sessions and also track additional in-app ev --- -Built with AppsFlyer Android SDK `v6.10.2` +Built with AppsFlyer Android SDK `v6.10.3` ## Table of content @@ -95,7 +95,7 @@ And to start the AppsFlyer SDK, use `void startAppsFlyer(Context context)` API. Add the AppsFlyer Segment Integration dependency to your app `build.gradle` file. ```java -implementation 'com.appsflyer:segment-android-integration:6.10.2' +implementation 'com.appsflyer:segment-android-integration:6.10.3' implementation 'com.android.installreferrer:installreferrer:2.1' ``` diff --git a/app/build.gradle b/app/build.gradle index 3991981..834e501 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -39,7 +39,7 @@ android { dependencies { implementation 'androidx.test.ext:junit:1.1.5' - implementation 'com.appsflyer:af-android-sdk:6.10.2' + implementation 'com.appsflyer:af-android-sdk:6.10.3' compileOnly 'com.android.installreferrer:installreferrer:2.1' compileOnly 'com.segment.analytics.android:analytics:4.+' testImplementation 'androidx.test:core:1.4.0' @@ -59,4 +59,4 @@ tasks.withType(Test) { } } -apply from:file("publish.gradle") \ No newline at end of file +apply from:file("publish.gradle") diff --git a/app/publish.gradle b/app/publish.gradle index 961640c..fce6aff 100644 --- a/app/publish.gradle +++ b/app/publish.gradle @@ -119,11 +119,10 @@ afterEvaluate { } } -signing { - logger("signing") - sign publishing.publications -} - + signing { + logger("signing") + sign publishing.publications + } publish.dependsOn build publishToMavenLocal.dependsOn build \ No newline at end of file diff --git a/app/src/main/java/com/segment/analytics/android/integrations/appsflyer/AppsflyerIntegration.java b/app/src/main/java/com/segment/analytics/android/integrations/appsflyer/AppsflyerIntegration.java index d3bb361..f406325 100644 --- a/app/src/main/java/com/segment/analytics/android/integrations/appsflyer/AppsflyerIntegration.java +++ b/app/src/main/java/com/segment/analytics/android/integrations/appsflyer/AppsflyerIntegration.java @@ -98,7 +98,7 @@ public Integration create(ValueMap settings, Analytics analytics) listener = new ConversionListener(analytics); } - AppsFlyerLib.getInstance().setPluginInfo(new PluginInfo(Plugin.SEGMENT,"6.10.2")); + AppsFlyerLib.getInstance().setPluginInfo(new PluginInfo(Plugin.SEGMENT,"6.10.3")); afLib.setDebugLog(logger.logLevel != Analytics.LogLevel.NONE); afLib.init(devKey, listener, application.getApplicationContext()); if (deepLinkListener != null) @@ -321,4 +321,4 @@ private Context getContext() { -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index 05b1498..b4521a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,8 +19,8 @@ GROUP=com.appsflyer -VERSION_CODE=12 -VERSION_NAME=6.10.2 +VERSION_CODE=13 +VERSION_NAME=6.10.3 POM_ARTIFACT_ID=segment-android-integration POM_PACKAGING=aar @@ -40,4 +40,4 @@ POM_DEVELOPER_ID=appsflyer POM_DEVELOPER_NAME=AppsFlyer, Inc. android.useAndroidX=true -android.enableJetifier=true \ No newline at end of file +android.enableJetifier=true diff --git a/segmenttestapp/build.gradle b/segmenttestapp/build.gradle index 0199a04..0344169 100644 --- a/segmenttestapp/build.gradle +++ b/segmenttestapp/build.gradle @@ -27,7 +27,7 @@ dependencies { implementation project(path: ':app') testImplementation 'junit:junit:4.12' implementation 'com.android.support:appcompat-v7:28.0.0' - implementation 'com.appsflyer:af-android-sdk:6.10.2' + implementation 'com.appsflyer:af-android-sdk:6.10.3' implementation 'com.segment.analytics.android:analytics:4.+' implementation 'com.android.installreferrer:installreferrer:2.1' -} \ No newline at end of file +}