From 5c14629de71f8be0a2b67e71c988875e7af71f4d Mon Sep 17 00:00:00 2001 From: Sergey Sozinov <103035673+sergeysozinov@users.noreply.github.com> Date: Thu, 27 Mar 2025 17:44:31 +0300 Subject: [PATCH 1/8] WMSDK-429: change notification request in example --- .../flutter_example/lib/view_model/view_model.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/example/flutter_example/lib/view_model/view_model.dart b/example/flutter_example/lib/view_model/view_model.dart index 9922ebe..6b0afc6 100644 --- a/example/flutter_example/lib/view_model/view_model.dart +++ b/example/flutter_example/lib/view_model/view_model.dart @@ -67,12 +67,12 @@ class ViewModel { } static Future requestPermissions() async { - Permission.notification.isDenied.then((bool isGranted) async { - final PermissionStatus status = await Permission.notification.request(); - - Mindbox.instance - .updateNotificationPermissionStatus(granted: status.isGranted); - }); + var status = await Permission.notification.status; + if (!status.isGranted) { + status = await Permission.notification.request(); + Mindbox.instance.updateNotificationPermissionStatus( + granted: status.isGranted); + } } //https://developers.mindbox.ru/docs/in-app From 11b3c0a37bb26035ae35c68679e73d449014798f Mon Sep 17 00:00:00 2001 From: Sergey Sozinov <103035673+sergeysozinov@users.noreply.github.com> Date: Fri, 25 Apr 2025 12:28:06 +0300 Subject: [PATCH 2/8] Bump SDK version to 2.13.2-rc --- mindbox/CHANGELOG.md | 7 ++++++- mindbox/pubspec.yaml | 8 ++++---- mindbox_android/CHANGELOG.md | 6 +++++- mindbox_android/android/build.gradle | 2 +- mindbox_android/pubspec.yaml | 4 ++-- mindbox_ios/CHANGELOG.md | 6 +++++- mindbox_ios/ios/mindbox_ios.podspec | 6 +++--- mindbox_ios/pubspec.yaml | 4 ++-- mindbox_platform_interface/CHANGELOG.md | 7 ++++++- mindbox_platform_interface/pubspec.yaml | 2 +- 10 files changed, 35 insertions(+), 17 deletions(-) diff --git a/mindbox/CHANGELOG.md b/mindbox/CHANGELOG.md index 03e7a51..dd6b3b2 100644 --- a/mindbox/CHANGELOG.md +++ b/mindbox/CHANGELOG.md @@ -1,4 +1,9 @@ --e ## 2.13.1 +## 2.13.2-rc + +* Upgrade native Android SDK dependency to v2.13.2-rc. +* Upgrade native iOS SDK dependency to v2.13.2-rc. + +## 2.13.1 * Upgrade native Android SDK dependency to v2.13.0. * Upgrade native iOS SDK dependency to v2.13.1. diff --git a/mindbox/pubspec.yaml b/mindbox/pubspec.yaml index 3c5294e..9d3eb21 100644 --- a/mindbox/pubspec.yaml +++ b/mindbox/pubspec.yaml @@ -1,6 +1,6 @@ name: mindbox description: Flutter Mindbox SDK. Plugin wrapper over of Mindbox iOS/Android SDK. -version: 2.13.1 +version: 2.13.2-rc homepage: https://mindbox.cloud/ repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox documentation: https://developers.mindbox.ru/docs/flutter-sdk-integration @@ -20,9 +20,9 @@ flutter: dependencies: flutter: sdk: flutter - mindbox_android: ^2.13.1 - mindbox_ios: ^2.13.1 - mindbox_platform_interface: ^2.13.1 + mindbox_android: ^2.13.2-rc + mindbox_ios: ^2.13.2-rc + mindbox_platform_interface: ^2.13.2-rc dev_dependencies: flutter_test: diff --git a/mindbox_android/CHANGELOG.md b/mindbox_android/CHANGELOG.md index c356f18..21f7a99 100644 --- a/mindbox_android/CHANGELOG.md +++ b/mindbox_android/CHANGELOG.md @@ -1,4 +1,8 @@ --e ## 2.13.1 +## 2.13.2-rc + +* Upgrade native Android SDK dependency to v2.13.2-rc. + +## 2.13.1 * Upgrade native Android SDK dependency to v2.13.0. diff --git a/mindbox_android/android/build.gradle b/mindbox_android/android/build.gradle index f2b5cdb..a562475 100644 --- a/mindbox_android/android/build.gradle +++ b/mindbox_android/android/build.gradle @@ -50,5 +50,5 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - api 'cloud.mindbox:mobile-sdk:2.13.0' + api 'cloud.mindbox:mobile-sdk:2.13.2-rc' } diff --git a/mindbox_android/pubspec.yaml b/mindbox_android/pubspec.yaml index 471d5f7..fd2c637 100644 --- a/mindbox_android/pubspec.yaml +++ b/mindbox_android/pubspec.yaml @@ -1,6 +1,6 @@ name: mindbox_android description: The implementation of 'mindbox' plugin for the Android platform. -version: 2.13.1 +version: 2.13.2-rc homepage: https://mindbox.cloud/ repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_android @@ -19,7 +19,7 @@ flutter: dependencies: flutter: sdk: flutter - mindbox_platform_interface: ^2.13.1 + mindbox_platform_interface: ^2.13.2-rc dev_dependencies: flutter_test: diff --git a/mindbox_ios/CHANGELOG.md b/mindbox_ios/CHANGELOG.md index a95726f..357f44f 100644 --- a/mindbox_ios/CHANGELOG.md +++ b/mindbox_ios/CHANGELOG.md @@ -1,4 +1,8 @@ --e ## 2.13.1 +## 2.13.2-rc + +* Upgrade native iOS SDK dependency to v2.13.2-rc. + +## 2.13.1 * Upgrade native iOS SDK dependency to v2.13.1. diff --git a/mindbox_ios/ios/mindbox_ios.podspec b/mindbox_ios/ios/mindbox_ios.podspec index 06ebd20..04e9b37 100644 --- a/mindbox_ios/ios/mindbox_ios.podspec +++ b/mindbox_ios/ios/mindbox_ios.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'mindbox_ios' - s.version = '2.13.1' + s.version = '2.13.2-rc' s.summary = 'Mindbox Flutter SDK' s.description = <<-DESC The implementation of 'mindbox' plugin for the iOS platform @@ -15,8 +15,8 @@ The implementation of 'mindbox' plugin for the iOS platform s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Mindbox', '2.13.1' - s.dependency 'MindboxNotifications', '2.13.1' + s.dependency 'Mindbox', '2.13.2-rc' + s.dependency 'MindboxNotifications', '2.13.2-rc' s.platform = :ios, '12.0' # Flutter.framework does not contain a i386 slice. diff --git a/mindbox_ios/pubspec.yaml b/mindbox_ios/pubspec.yaml index a10b390..b31cfc0 100644 --- a/mindbox_ios/pubspec.yaml +++ b/mindbox_ios/pubspec.yaml @@ -1,6 +1,6 @@ name: mindbox_ios description: The implementation of 'mindbox' plugin for the iOS platform. -version: 2.13.1 +version: 2.13.2-rc homepage: https://mindbox.cloud/ repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_ios @@ -18,7 +18,7 @@ flutter: dependencies: flutter: sdk: flutter - mindbox_platform_interface: ^2.13.1 + mindbox_platform_interface: ^2.13.2-rc dev_dependencies: flutter_test: diff --git a/mindbox_platform_interface/CHANGELOG.md b/mindbox_platform_interface/CHANGELOG.md index 91975a5..bb31a2e 100644 --- a/mindbox_platform_interface/CHANGELOG.md +++ b/mindbox_platform_interface/CHANGELOG.md @@ -1,4 +1,9 @@ --e ## 2.13.1 +## 2.13.2-rc + +* Upgrade native Android SDK dependency to v2.13.2-rc. +* Upgrade native iOS SDK dependency to v2.13.2-rc. + +## 2.13.1 * Upgrade native Android SDK dependency to v2.13.0. * Upgrade native iOS SDK dependency to v2.13.1. diff --git a/mindbox_platform_interface/pubspec.yaml b/mindbox_platform_interface/pubspec.yaml index de20b0f..c96ceab 100644 --- a/mindbox_platform_interface/pubspec.yaml +++ b/mindbox_platform_interface/pubspec.yaml @@ -1,6 +1,6 @@ name: mindbox_platform_interface description: Mindbox platform interface. -version: 2.13.1 +version: 2.13.2-rc homepage: https://mindbox.cloud/ repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_platform_interface From 7d9ca60313ccd5d333d3c6a90ad0897112724728 Mon Sep 17 00:00:00 2001 From: Sergey Sozinov <103035673+sergeysozinov@users.noreply.github.com> Date: Wed, 30 Apr 2025 14:04:18 +0300 Subject: [PATCH 3/8] WMSDK-443: change publish flow --- .github/workflows/analyze_and_test.yml | 14 ++++ .github/workflows/publish-manual.yml | 21 +++++ .github/workflows/publish-master.yml | 15 ++++ .github/workflows/publish-rc-mission.yml | 59 +++++++++++++ .../{publish.yml => publish-reusable.yml} | 83 ++++++++++++++----- .github/workflows/release-version-check.yml | 50 +++++++++++ .../workflows/trigger-build-app-develop.yml | 15 ++++ .../workflows/trigger-build-app-manual.yml | 10 +++ .../trigger-build-app-master-support.yml | 19 +++++ ...app.yml => trigger-build-app-reusable.yml} | 17 ++-- 10 files changed, 275 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/publish-manual.yml create mode 100644 .github/workflows/publish-master.yml create mode 100644 .github/workflows/publish-rc-mission.yml rename .github/workflows/{publish.yml => publish-reusable.yml} (66%) create mode 100644 .github/workflows/release-version-check.yml create mode 100644 .github/workflows/trigger-build-app-develop.yml create mode 100644 .github/workflows/trigger-build-app-manual.yml create mode 100644 .github/workflows/trigger-build-app-master-support.yml rename .github/workflows/{trigger-build-app.yml => trigger-build-app-reusable.yml} (72%) diff --git a/.github/workflows/analyze_and_test.yml b/.github/workflows/analyze_and_test.yml index f07651f..2115f75 100644 --- a/.github/workflows/analyze_and_test.yml +++ b/.github/workflows/analyze_and_test.yml @@ -4,6 +4,10 @@ on: pull_request: branches: [ develop ] workflow_call: + inputs: + branch: + required: true + type: string jobs: platform_interface_flutter_test: @@ -11,6 +15,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch || github.head_ref }} - uses: actions/setup-java@v1 with: java-version: "12.x" @@ -29,6 +35,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch || github.head_ref }} - uses: actions/setup-java@v1 with: java-version: "12.x" @@ -50,6 +58,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch || github.head_ref }} - uses: actions/setup-java@v1 with: java-version: "12.x" @@ -71,6 +81,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch || github.head_ref }} - uses: actions/setup-java@v1 with: java-version: "12.x" @@ -86,6 +98,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch || github.head_ref }} - uses: actions/setup-java@v1 with: java-version: "12.x" diff --git a/.github/workflows/publish-manual.yml b/.github/workflows/publish-manual.yml new file mode 100644 index 0000000..3937a55 --- /dev/null +++ b/.github/workflows/publish-manual.yml @@ -0,0 +1,21 @@ +name: SDK publish manual + +on: + workflow_dispatch: + +jobs: + check-branch: + runs-on: ubuntu-latest + steps: + - name: Check if branch matches pattern + run: | + if ! echo "${{ github.ref_name }}" | grep -q "release/.*-rc"; then + echo "Branch name must match pattern 'release/*-rc' (e.g. release/2.13.2-rc)" + exit 1 + fi + + call-publish-reusable: + needs: check-branch + uses: ./.github/workflows/publish-reusable.yml + with: + branch: ${{ github.ref_name }} \ No newline at end of file diff --git a/.github/workflows/publish-master.yml b/.github/workflows/publish-master.yml new file mode 100644 index 0000000..8924d15 --- /dev/null +++ b/.github/workflows/publish-master.yml @@ -0,0 +1,15 @@ +name: SDK publish flutter master and support + +on: + pull_request: + types: [closed] + branches: + - 'master' + - 'support/*' + +jobs: + call-reusable: + if: ${{ github.event.pull_request.merged == true }} + uses: ./.github/workflows/publish-reusable.yml + with: + branch: ${{ github.base_ref }} \ No newline at end of file diff --git a/.github/workflows/publish-rc-mission.yml b/.github/workflows/publish-rc-mission.yml new file mode 100644 index 0000000..f2a6618 --- /dev/null +++ b/.github/workflows/publish-rc-mission.yml @@ -0,0 +1,59 @@ +name: SDK publish RC mission + +on: + issue_comment: + types: [created] + branches: + - 'mission/*' + +jobs: + get-branch: + runs-on: ubuntu-latest + outputs: + branch: ${{ steps.get-branch.outputs.branch }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Get PR branch + id: get-branch + run: | + pr_info=$(gh pr view ${{ github.event.issue.number }} --json headRefName,state) + branch=$(echo "$pr_info" | jq -r '.headRefName') + state=$(echo "$pr_info" | jq -r '.state') + + if [ "$state" != "OPEN" ]; then + echo "PR is not in OPEN state (current state: $state)" + exit 1 + fi + + echo "Branch value: $branch" + echo "branch=$branch" >> $GITHUB_OUTPUT + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + call-publish-reusable: + needs: get-branch + if: | + github.event.issue.pull_request != null && + contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association) && + github.event.comment.body == '/release-sdk' && + contains(needs.get-branch.outputs.branch, 'release/') + uses: ./.github/workflows/publish-reusable.yml + with: + branch: ${{ needs.get-branch.outputs.branch }} + + close-pr: + needs: [call-publish-reusable, get-branch] + runs-on: ubuntu-latest + steps: + - name: Checkout PR branch + uses: actions/checkout@v4 + with: + ref: ${{ needs.get-branch.outputs.branch }} + + - name: Close PR + run: | + gh pr merge ${{ github.event.issue.number }} --merge + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish-reusable.yml similarity index 66% rename from .github/workflows/publish.yml rename to .github/workflows/publish-reusable.yml index f9eba36..8306497 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish-reusable.yml @@ -1,26 +1,29 @@ name: publish on: - pull_request: - types: [ closed ] - branches: - - master + workflow_call: + inputs: + branch: + required: true + type: string jobs: - analyze_and_test: - name: Analyze code and run tests before publishing - uses: ./.github/workflows/analyze_and_test.yml - - platform_interface_publish: + analyze_and_test: + name: Analyze code and run tests before publishing + uses: ./.github/workflows/analyze_and_test.yml + with: + branch: ${{ inputs.branch }} + + platform_interface_publish: needs: [analyze_and_test] - if: github.event.pull_request.merged timeout-minutes: 4 runs-on: ubuntu-latest name: mindbox_platform_interface publishing steps: - - uses: actions/checkout@v2.3.3 + - uses: actions/checkout@v4 with: fetch-depth: 2 + ref: ${{ inputs.branch }} - name: Check package Pubspec id: pubspec run: | @@ -52,9 +55,8 @@ jobs: draft: false prerelease: false - native_components_publish: - needs: [analyze_and_test,platform_interface_publish] - if: github.event.pull_request.merged + native_components_publish: + needs: [analyze_and_test, platform_interface_publish] timeout-minutes: 4 runs-on: ubuntu-latest name: ${{ matrix.package }} publishing @@ -66,9 +68,10 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v2.3.3 + - uses: actions/checkout@v4 with: fetch-depth: 2 + ref: ${{ inputs.branch }} - name: Check package Pubspec id: pubspec run: | @@ -99,17 +102,17 @@ jobs: release_name: ${{ matrix.package }} v${{ env.VERSION }} draft: false prerelease: false - - plugin_publish: - needs: [analyze_and_test,platform_interface_publish, native_components_publish] - if: github.event.pull_request.merged + + plugin_publish: + needs: [analyze_and_test, platform_interface_publish, native_components_publish] timeout-minutes: 4 runs-on: ubuntu-latest name: mindbox publishing steps: - - uses: actions/checkout@v2.3.3 + - uses: actions/checkout@v4 with: fetch-depth: 2 + ref: ${{ inputs.branch }} - name: Check package Pubspec id: pubspec run: | @@ -141,3 +144,43 @@ jobs: release_name: mindbox v${{ env.VERSION }} draft: false prerelease: false + + merge: + needs: [plugin_publish] + if: | + startsWith(github.head_ref, 'release') && + github.base_ref == 'master' + runs-on: ubuntu-latest + steps: + - name: Checkout develop branch + uses: actions/checkout@v4 + with: + ref: develop + - name: Create Pull Request + run: gh pr create --base develop --head master --title "Merge 'master' into 'develop' after release" --body "Automated Pull Request to merge 'master' into 'develop' after release" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Merge Pull Request + run: | + pr_number=$(gh pr list --base develop --head master --json number --jq '.[0].number') + gh pr merge $pr_number --merge + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + message-to-loop-if-success: + needs: [ merge ] + runs-on: ubuntu-latest + steps: + - name: Send message to LOOP + env: + LOOP_NOTIFICATION_WEBHOOK_URL: ${{ secrets.LOOP_NOTIFICATION_WEBHOOK_URL }} + VERSION: ${{ inputs.branch }} + run: | + MESSAGE=$(cat <> $GITHUB_ENV + echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV + - name: Compare versions + uses: jackbilestech/semver-compare@1.0.4 + with: + head: ${{ env.RELEASE_VERSION }} + base: ${{ env.MASTER_VERSION }} + operator: '>' \ No newline at end of file diff --git a/.github/workflows/trigger-build-app-develop.yml b/.github/workflows/trigger-build-app-develop.yml new file mode 100644 index 0000000..01440fd --- /dev/null +++ b/.github/workflows/trigger-build-app-develop.yml @@ -0,0 +1,15 @@ +name: Build application after merge into develop + +on: + pull_request: + types: [closed] + branches: + - 'develop' + +jobs: + call-reusable: + if: ${{ github.event.pull_request.merged == true }} + uses: ./.github/workflows/trigger-build-app-reusable.yml + with: + branch: ${{ github.base_ref }} + secrets: inherit diff --git a/.github/workflows/trigger-build-app-manual.yml b/.github/workflows/trigger-build-app-manual.yml new file mode 100644 index 0000000..2e93a2f --- /dev/null +++ b/.github/workflows/trigger-build-app-manual.yml @@ -0,0 +1,10 @@ +name: Build application manual + +on: + workflow_dispatch: + +jobs: + call-reusable: + uses: ./.github/workflows/trigger-build-app-reusable.yml + with: + branch: ${{ github.ref_name }} \ No newline at end of file diff --git a/.github/workflows/trigger-build-app-master-support.yml b/.github/workflows/trigger-build-app-master-support.yml new file mode 100644 index 0000000..19e46e8 --- /dev/null +++ b/.github/workflows/trigger-build-app-master-support.yml @@ -0,0 +1,19 @@ +name: Build application when create PR into master/support/mission + +on: + pull_request: + branches: + - master + - support/* + - mission/* + types: + - opened + - synchronize + +jobs: + call-reusable: + if: ${{ startsWith(github.event.pull_request.head.ref, 'release/') }} + uses: ./.github/workflows/trigger-build-app-reusable.yml + with: + branch: ${{ github.event.pull_request.head.ref }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/trigger-build-app.yml b/.github/workflows/trigger-build-app-reusable.yml similarity index 72% rename from .github/workflows/trigger-build-app.yml rename to .github/workflows/trigger-build-app-reusable.yml index e54e7ea..3d98247 100644 --- a/.github/workflows/trigger-build-app.yml +++ b/.github/workflows/trigger-build-app-reusable.yml @@ -1,19 +1,20 @@ -name: Build application after merge +name: Build application on: - pull_request: - types: [closed] - branches: - - 'feature/*' - - 'develop' + workflow_call: + inputs: + branch: + required: true + type: string jobs: trigger: runs-on: macos-latest - if: github.event.pull_request.merged == true steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} - name: Get last 3 commit messages run: | @@ -25,5 +26,5 @@ jobs: curl --location 'https://mindbox.gitlab.yandexcloud.net/api/v4/projects/1089/trigger/pipeline' \ --form 'token="${{ secrets.GITLAB_TRIGGER_TOKEN }}"' \ --form 'ref="develop"' \ - --form "variables[INPUT_BRANCH]=\"${{ github.head_ref }}\"" \ + --form "variables[INPUT_BRANCH]=\"${{ inputs.branch }}\"" \ --form "variables[INPUT_COMMITS]=\"${{ env.commits }}\"" From b3efe87c6dd9576db12e9af4abfa5d0f940e9ed9 Mon Sep 17 00:00:00 2001 From: Sergey Sozinov <103035673+sergeysozinov@users.noreply.github.com> Date: Mon, 12 May 2025 15:23:33 +0300 Subject: [PATCH 4/8] WMSDK-443: update workflows --- .github/workflows/pr-description-validate.yml | 2 +- .github/workflows/publish-manual.yml | 3 +- .github/workflows/publish-master.yml | 3 +- .github/workflows/publish-rc-mission.yml | 59 ------------------- .github/workflows/publish-reusable.yml | 1 + .../workflows/trigger-build-app-manual.yml | 3 +- 6 files changed, 8 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/publish-rc-mission.yml diff --git a/.github/workflows/pr-description-validate.yml b/.github/workflows/pr-description-validate.yml index ee497c9..af3a1f3 100644 --- a/.github/workflows/pr-description-validate.yml +++ b/.github/workflows/pr-description-validate.yml @@ -9,7 +9,7 @@ on: jobs: check-description: runs-on: ubuntu-latest - + if: ${{ github.event_name == 'pull_request' || github.event.issue.pull_request }} steps: - name: Check out the repository uses: actions/checkout@v4 diff --git a/.github/workflows/publish-manual.yml b/.github/workflows/publish-manual.yml index 3937a55..3337928 100644 --- a/.github/workflows/publish-manual.yml +++ b/.github/workflows/publish-manual.yml @@ -18,4 +18,5 @@ jobs: needs: check-branch uses: ./.github/workflows/publish-reusable.yml with: - branch: ${{ github.ref_name }} \ No newline at end of file + branch: ${{ github.ref_name }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/publish-master.yml b/.github/workflows/publish-master.yml index 8924d15..dd9b665 100644 --- a/.github/workflows/publish-master.yml +++ b/.github/workflows/publish-master.yml @@ -12,4 +12,5 @@ jobs: if: ${{ github.event.pull_request.merged == true }} uses: ./.github/workflows/publish-reusable.yml with: - branch: ${{ github.base_ref }} \ No newline at end of file + branch: ${{ github.base_ref }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/publish-rc-mission.yml b/.github/workflows/publish-rc-mission.yml deleted file mode 100644 index f2a6618..0000000 --- a/.github/workflows/publish-rc-mission.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: SDK publish RC mission - -on: - issue_comment: - types: [created] - branches: - - 'mission/*' - -jobs: - get-branch: - runs-on: ubuntu-latest - outputs: - branch: ${{ steps.get-branch.outputs.branch }} - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Get PR branch - id: get-branch - run: | - pr_info=$(gh pr view ${{ github.event.issue.number }} --json headRefName,state) - branch=$(echo "$pr_info" | jq -r '.headRefName') - state=$(echo "$pr_info" | jq -r '.state') - - if [ "$state" != "OPEN" ]; then - echo "PR is not in OPEN state (current state: $state)" - exit 1 - fi - - echo "Branch value: $branch" - echo "branch=$branch" >> $GITHUB_OUTPUT - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - call-publish-reusable: - needs: get-branch - if: | - github.event.issue.pull_request != null && - contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association) && - github.event.comment.body == '/release-sdk' && - contains(needs.get-branch.outputs.branch, 'release/') - uses: ./.github/workflows/publish-reusable.yml - with: - branch: ${{ needs.get-branch.outputs.branch }} - - close-pr: - needs: [call-publish-reusable, get-branch] - runs-on: ubuntu-latest - steps: - - name: Checkout PR branch - uses: actions/checkout@v4 - with: - ref: ${{ needs.get-branch.outputs.branch }} - - - name: Close PR - run: | - gh pr merge ${{ github.event.issue.number }} --merge - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish-reusable.yml b/.github/workflows/publish-reusable.yml index 8306497..9fcf081 100644 --- a/.github/workflows/publish-reusable.yml +++ b/.github/workflows/publish-reusable.yml @@ -13,6 +13,7 @@ jobs: uses: ./.github/workflows/analyze_and_test.yml with: branch: ${{ inputs.branch }} + secrets: inherit platform_interface_publish: needs: [analyze_and_test] diff --git a/.github/workflows/trigger-build-app-manual.yml b/.github/workflows/trigger-build-app-manual.yml index 2e93a2f..5c7ae41 100644 --- a/.github/workflows/trigger-build-app-manual.yml +++ b/.github/workflows/trigger-build-app-manual.yml @@ -7,4 +7,5 @@ jobs: call-reusable: uses: ./.github/workflows/trigger-build-app-reusable.yml with: - branch: ${{ github.ref_name }} \ No newline at end of file + branch: ${{ github.ref_name }} + secrets: inherit \ No newline at end of file From 73ae33312ab26f07c36dcbdcfa8d96c24d4e5a7c Mon Sep 17 00:00:00 2001 From: Sergei Semko <28645140+justSmK@users.noreply.github.com> Date: Fri, 23 May 2025 11:01:34 +0300 Subject: [PATCH 5/8] WMSDK-450: CI/CD (#158) * WMSDK-450: New script, tests on push and PR, delay in publish, fix loop * WMSDK-450: Rename scripts and files * WMSDK-450: Add name for tests * WMSDK-450: Some fixes --- .github/workflows/analyze_and_test.yml | 17 +- ...app-develop.yml => distribute-develop.yml} | 4 +- .github/workflows/distribute-manual.yml | 11 + ...=> distribute-release-support-mission.yml} | 6 +- ...p-reusable.yml => distribute-reusable.yml} | 10 +- .../manual-prepare_release_branch.yml | 245 ++++++++++++++++++ ...yml => publish-from-master-or-support.yml} | 4 +- .github/workflows/publish-manual.yml | 4 +- .github/workflows/publish-reusable.yml | 30 ++- .github/workflows/release-version-check.yml | 4 +- .../workflows/trigger-build-app-manual.yml | 11 - 11 files changed, 307 insertions(+), 39 deletions(-) rename .github/workflows/{trigger-build-app-develop.yml => distribute-develop.yml} (66%) create mode 100644 .github/workflows/distribute-manual.yml rename .github/workflows/{trigger-build-app-master-support.yml => distribute-release-support-mission.yml} (66%) rename .github/workflows/{trigger-build-app-reusable.yml => distribute-reusable.yml} (69%) create mode 100644 .github/workflows/manual-prepare_release_branch.yml rename .github/workflows/{publish-master.yml => publish-from-master-or-support.yml} (79%) delete mode 100644 .github/workflows/trigger-build-app-manual.yml diff --git a/.github/workflows/analyze_and_test.yml b/.github/workflows/analyze_and_test.yml index 2115f75..3b17713 100644 --- a/.github/workflows/analyze_and_test.yml +++ b/.github/workflows/analyze_and_test.yml @@ -1,8 +1,20 @@ -name: analyze_and_test +name: Analyzes and Tests on: + push: + branches: + - '**' + - '!master' + paths-ignore: + - '**.md' + tags-ignore: + - '**' pull_request: - branches: [ develop ] + branches: + - master + - mission/* + types: + - opened workflow_call: inputs: branch: @@ -139,4 +151,3 @@ jobs: - run: cd mindbox && flutter pub get - run: cd mindbox && flutter analyze - run: cd mindbox && flutter test - diff --git a/.github/workflows/trigger-build-app-develop.yml b/.github/workflows/distribute-develop.yml similarity index 66% rename from .github/workflows/trigger-build-app-develop.yml rename to .github/workflows/distribute-develop.yml index 01440fd..53b1879 100644 --- a/.github/workflows/trigger-build-app-develop.yml +++ b/.github/workflows/distribute-develop.yml @@ -1,4 +1,4 @@ -name: Build application after merge into develop +name: PushOk (Develop PR Merge) on: pull_request: @@ -9,7 +9,7 @@ on: jobs: call-reusable: if: ${{ github.event.pull_request.merged == true }} - uses: ./.github/workflows/trigger-build-app-reusable.yml + uses: ./.github/workflows/distribute-reusable.yml with: branch: ${{ github.base_ref }} secrets: inherit diff --git a/.github/workflows/distribute-manual.yml b/.github/workflows/distribute-manual.yml new file mode 100644 index 0000000..8c21bc7 --- /dev/null +++ b/.github/workflows/distribute-manual.yml @@ -0,0 +1,11 @@ +name: Distribute PushOk (manual) + +on: + workflow_dispatch: + +jobs: + call-reusable: + uses: ./.github/workflows/distribute-reusable.yml + with: + branch: ${{ github.ref_name }} + secrets: inherit diff --git a/.github/workflows/trigger-build-app-master-support.yml b/.github/workflows/distribute-release-support-mission.yml similarity index 66% rename from .github/workflows/trigger-build-app-master-support.yml rename to .github/workflows/distribute-release-support-mission.yml index 19e46e8..06ffa4c 100644 --- a/.github/workflows/trigger-build-app-master-support.yml +++ b/.github/workflows/distribute-release-support-mission.yml @@ -1,4 +1,4 @@ -name: Build application when create PR into master/support/mission +name: Distribute PushOk (Release / Support / Mission PRs) on: pull_request: @@ -13,7 +13,7 @@ on: jobs: call-reusable: if: ${{ startsWith(github.event.pull_request.head.ref, 'release/') }} - uses: ./.github/workflows/trigger-build-app-reusable.yml + uses: ./.github/workflows/distribute-reusable.yml with: branch: ${{ github.event.pull_request.head.ref }} - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/trigger-build-app-reusable.yml b/.github/workflows/distribute-reusable.yml similarity index 69% rename from .github/workflows/trigger-build-app-reusable.yml rename to .github/workflows/distribute-reusable.yml index 3d98247..310feae 100644 --- a/.github/workflows/trigger-build-app-reusable.yml +++ b/.github/workflows/distribute-reusable.yml @@ -1,4 +1,4 @@ -name: Build application +name: Distribute PushOk - Reusable on: workflow_call: @@ -24,7 +24,7 @@ jobs: - name: Trigger build workflow in flutter-app repo run: | curl --location 'https://mindbox.gitlab.yandexcloud.net/api/v4/projects/1089/trigger/pipeline' \ - --form 'token="${{ secrets.GITLAB_TRIGGER_TOKEN }}"' \ - --form 'ref="develop"' \ - --form "variables[INPUT_BRANCH]=\"${{ inputs.branch }}\"" \ - --form "variables[INPUT_COMMITS]=\"${{ env.commits }}\"" + --form "token=${{ secrets.GITLAB_TRIGGER_TOKEN }}" \ + --form "ref=develop" \ + --form "variables[INPUT_BRANCH]=${{ inputs.branch }}" \ + --form "variables[INPUT_COMMITS]=${{ env.commits }}" diff --git a/.github/workflows/manual-prepare_release_branch.yml b/.github/workflows/manual-prepare_release_branch.yml new file mode 100644 index 0000000..9994bb0 --- /dev/null +++ b/.github/workflows/manual-prepare_release_branch.yml @@ -0,0 +1,245 @@ +name: "Manual Release Prep: Branch & Version Bump" + +on: + workflow_dispatch: + inputs: + release_version: + description: 'Cross-platform release version (e.g. 1.2.3 or 1.2.3-rc)' + required: true + android_sdk_version: + description: 'Native Android SDK version (optional, defaults to cross-platform version)' + required: false + default: '' + ios_sdk_version: + description: 'Native iOS SDK version (optional, defaults to cross-platform version)' + required: false + default: '' + source_branch: + description: 'Create branch from' + required: true + default: 'develop' + target_branch: + description: 'Pull Request to' + required: true + default: 'master' + +jobs: + validate-input: + name: Validate versions format + runs-on: ubuntu-latest + steps: + - name: Check release_version matches semver + run: | + V=${{ github.event.inputs.release_version }} + echo "Input release_version=$V" + if ! [[ "$V" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then + echo "❌ release_version must be X.Y.Z or X.Y.Z-rc" + exit 1 + fi + - name: Validate Android SDK version if provided + if: ${{ github.event.inputs.android_sdk_version != '' }} + run: | + A=${{ github.event.inputs.android_sdk_version }} + echo "Input android_sdk_version=$A" + if ! [[ "$A" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then + echo "❌ android_sdk_version must be X.Y.Z or X.Y.Z-rc" + exit 1 + fi + - name: Validate iOS SDK version if provided + if: ${{ github.event.inputs.ios_sdk_version != '' }} + run: | + I=${{ github.event.inputs.ios_sdk_version }} + echo "Input ios_sdk_version=$I" + if ! [[ "$I" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then + echo "❌ ios_sdk_version must be X.Y.Z or X.Y.Z-rc" + exit 1 + fi + + validate-branches: + name: Validate branch names exist + runs-on: ubuntu-latest + needs: validate-input + steps: + - name: Checkout minimal repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Check source branch + run: | + SRC=${{ github.event.inputs.source_branch }} + echo "Source branch: $SRC" + if ! git ls-remote --heads origin "$SRC" | grep -q "$SRC"; then + echo "❌ source_branch '$SRC' does not exist" + exit 1 + fi + - name: Check target branch + run: | + DST=${{ github.event.inputs.target_branch }} + echo "Target branch: $DST" + if ! git ls-remote --heads origin "$DST" | grep -q "$DST"; then + echo "❌ target_branch '$DST' does not exist" + exit 1 + fi + + bump_and_branch: + name: Create release branch & bump versions + runs-on: ubuntu-latest + needs: validate-branches + outputs: + release_branch: ${{ steps.bump.outputs.release_branch }} + steps: + - name: Checkout source branch + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.source_branch }} + fetch-depth: 0 + + - name: Configure Git identity for GitHub Action Bot + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Create branch and update versions + id: bump + run: | + set -euo pipefail + VERSION="${{ github.event.inputs.release_version }}" + AND_VER="${{ github.event.inputs.android_sdk_version }}" + IO_VER="${{ github.event.inputs.ios_sdk_version }}" + SRC="${{ github.event.inputs.source_branch }}" + REL="release/$VERSION" + + echo "Parameters before fallback: AND_VER=$AND_VER, IO_VER=$IO_VER" + # fallback to cross-platform version + [ -z "$AND_VER" ] && AND_VER="$VERSION" + [ -z "$IO_VER" ] && IO_VER="$VERSION" + echo "Using versions: Flutter=$VERSION, Android=$AND_VER, iOS=$IO_VER" + + echo "→ Branching from $SRC into $REL" + git checkout -b "$REL" + + echo "→ Current pubspec versions before bump:" + grep '^version:' mindbox/pubspec.yaml || true + grep '^version:' mindbox_android/pubspec.yaml || true + grep '^version:' mindbox_ios/pubspec.yaml || true + grep '^version:' mindbox_platform_interface/pubspec.yaml || true + + echo "→ Updating pubspec versions" + for yaml in \ + mindbox/pubspec.yaml \ + mindbox_android/pubspec.yaml \ + mindbox_ios/pubspec.yaml \ + mindbox_platform_interface/pubspec.yaml; do + + # bump version of the package + sed -i "s/^version:.*/version: $VERSION/" "$yaml" + + # raise all flutter dependencies in the root pubspec + if [ "$yaml" = "mindbox/pubspec.yaml" ]; then + sed -i "s/^ mindbox_android:.*/ mindbox_android: ^$VERSION/" "$yaml" + sed -i "s/^ mindbox_ios:.*/ mindbox_ios: ^$VERSION/" "$yaml" + sed -i "s/^ mindbox_platform_interface:.*/ mindbox_platform_interface: ^$VERSION/" "$yaml" + fi + + # in the Android plugin also update platform_interface + if [ "$yaml" = "mindbox_android/pubspec.yaml" ]; then + sed -i "s/^ mindbox_platform_interface:.*/ mindbox_platform_interface: ^$VERSION/" "$yaml" + fi + + # in iOS plugin: only platform_interface + if [ "$yaml" = "mindbox_ios/pubspec.yaml" ]; then + sed -i "s/^ mindbox_platform_interface:.*/ mindbox_platform_interface: ^$VERSION/" "$yaml" + fi + + done + + echo "→ Bumping Android native SDK in build.gradle" + echo " Before:" && grep "cloud.mindbox:mobile-sdk" mindbox_android/android/build.gradle || true + sed -i "s/cloud.mindbox:mobile-sdk:.*/cloud.mindbox:mobile-sdk:$AND_VER'/" mindbox_android/android/build.gradle + echo " After:" && grep "cloud.mindbox:mobile-sdk" mindbox_android/android/build.gradle || true + + echo "→ Bumping iOS native SDK in podspec" + echo " Before s.version:" && grep -E "s\.version" mindbox_ios/ios/mindbox_ios.podspec || true + sed -i -E "s/(s\.version *= *')[^']+(')/\1$IO_VER\2/" mindbox_ios/ios/mindbox_ios.podspec + echo " After s.version:" && grep -E "s\.version" mindbox_ios/ios/mindbox_ios.podspec || true + + echo " Before Mindbox dependency:" && grep "s.dependency 'Mindbox'," mindbox_ios/ios/mindbox_ios.podspec || true + sed -i -E "s/(s\.dependency 'Mindbox', *')[^']+(')/\1$IO_VER\2/" mindbox_ios/ios/mindbox_ios.podspec + echo " After Mindbox dependency:" && grep "s.dependency 'Mindbox'," mindbox_ios/ios/mindbox_ios.podspec || true + + echo " Before Notifications dep:" && grep "MindboxNotifications" mindbox_ios/ios/mindbox_ios.podspec || true + sed -i -E "s/(s\.dependency 'MindboxNotifications', *')[^']+(')/\1$IO_VER\2/" mindbox_ios/ios/mindbox_ios.podspec + echo " After Notifications dep:" && grep "MindboxNotifications" mindbox_ios/ios/mindbox_ios.podspec || true + + echo "→ Now inspect pubspec.yaml versions:" + echo " mindbox/pubspec.yaml:" && grep "^version\|mindbox_" mindbox/pubspec.yaml || true + echo " mindbox_android/pubspec.yaml:" && grep "^version\|platform_interface" mindbox_android/pubspec.yaml || true + echo " mindbox_ios/pubspec.yaml:" && grep "^version\|platform_interface" mindbox_ios/pubspec.yaml || true + echo " mindbox_platform_interface/pubspec.yaml:" && grep "^version" mindbox_platform_interface/pubspec.yaml || true + + echo "→ Generating changelogs" + # mindbox: both native + file="mindbox/CHANGELOG.md" + echo -e "## $VERSION\n\n* Upgrade native Android SDK dependency to v$AND_VER.\n* Upgrade native iOS SDK dependency to v$IO_VER.\n\n$(cat $file)" > "$file" + git add "$file" + + # mindbox_android: only Android + file="mindbox_android/CHANGELOG.md" + echo -e "## $VERSION\n\n* Upgrade native Android SDK dependency to v$AND_VER.\n\n$(cat $file)" > "$file" + git add "$file" + + # mindbox_ios: only iOS + file="mindbox_ios/CHANGELOG.md" + echo -e "## $VERSION\n\n* Upgrade native iOS SDK dependency to v$IO_VER.\n\n$(cat $file)" > "$file" + git add "$file" + + # mindbox_platform_interface: both native + file="mindbox_platform_interface/CHANGELOG.md" + echo -e "## $VERSION\n\n* Upgrade native Android SDK dependency to v$AND_VER.\n* Upgrade native iOS SDK dependency to v$IO_VER.\n\n$(cat $file)" > "$file" + git add "$file" + + echo "→ Commit diff summary:" + git diff --stat + + echo "→ Staging all bumped files" + git add mindbox/pubspec.yaml \ + mindbox_android/pubspec.yaml \ + mindbox_ios/pubspec.yaml \ + mindbox_platform_interface/pubspec.yaml \ + mindbox_android/android/build.gradle \ + mindbox_ios/ios/mindbox_ios.podspec + + git commit -m "Bump SDK versions: Flutter=$VERSION, Android=$AND_VER, iOS=$IO_VER" + echo "release_branch=$REL" >> $GITHUB_OUTPUT + + - name: Push release branch + run: git push --set-upstream origin ${{ steps.bump.outputs.release_branch }} + + create_pull_request: + name: Create Pull Request + runs-on: ubuntu-latest + needs: bump_and_branch + steps: + - name: Create PR via GitHub CLI + env: + GITHUB_TOKEN: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} + SRC: ${{ needs.bump_and_branch.outputs.release_branch }} + DST: ${{ github.event.inputs.target_branch }} + REPO: ${{ github.repository }} + run: | + AND_VER=${{ github.event.inputs.android_sdk_version }} + IO_VER=${{ github.event.inputs.ios_sdk_version }} + [ -z "$AND_VER" ] && AND_VER="${{ github.event.inputs.release_version }}" + [ -z "$IO_VER" ] && IO_VER="${{ github.event.inputs.release_version }}" + + BODY=$( + printf 'Automated PR: merge `%s` into `%s`\n\n**Versions:**\n- Flutter SDK: `%s`\n- Android SDK: `%s`\n- iOS SDK: `%s`' \ + "$SRC" "$DST" "${{ github.event.inputs.release_version }}" "$AND_VER" "$IO_VER" + ) + + gh pr create \ + --repo "$REPO" \ + --base "$DST" \ + --head "$SRC" \ + --title "Release ${{ github.event.inputs.release_version }}" \ + --body "$BODY" diff --git a/.github/workflows/publish-master.yml b/.github/workflows/publish-from-master-or-support.yml similarity index 79% rename from .github/workflows/publish-master.yml rename to .github/workflows/publish-from-master-or-support.yml index dd9b665..adebf2e 100644 --- a/.github/workflows/publish-master.yml +++ b/.github/workflows/publish-from-master-or-support.yml @@ -1,4 +1,4 @@ -name: SDK publish flutter master and support +name: SDK publish from master or support branch on: pull_request: @@ -13,4 +13,4 @@ jobs: uses: ./.github/workflows/publish-reusable.yml with: branch: ${{ github.base_ref }} - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/publish-manual.yml b/.github/workflows/publish-manual.yml index 3337928..c4f2669 100644 --- a/.github/workflows/publish-manual.yml +++ b/.github/workflows/publish-manual.yml @@ -1,4 +1,4 @@ -name: SDK publish manual +name: SDK publish RC manual on: workflow_dispatch: @@ -19,4 +19,4 @@ jobs: uses: ./.github/workflows/publish-reusable.yml with: branch: ${{ github.ref_name }} - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/publish-reusable.yml b/.github/workflows/publish-reusable.yml index 9fcf081..e706114 100644 --- a/.github/workflows/publish-reusable.yml +++ b/.github/workflows/publish-reusable.yml @@ -1,4 +1,4 @@ -name: publish +name: SDK publish on: workflow_call: @@ -55,9 +55,16 @@ jobs: release_name: mindbox_platform_interface v${{ env.VERSION }} draft: false prerelease: false + + waiting-while-platform-interface-publish: + needs: [platform_interface_publish] + runs-on: ubuntu-latest + steps: + - name: Delay for 1 minutes + run: sleep 60 native_components_publish: - needs: [analyze_and_test, platform_interface_publish] + needs: [analyze_and_test, platform_interface_publish, waiting-while-platform-interface-publish] timeout-minutes: 4 runs-on: ubuntu-latest name: ${{ matrix.package }} publishing @@ -103,9 +110,16 @@ jobs: release_name: ${{ matrix.package }} v${{ env.VERSION }} draft: false prerelease: false + + waiting-while-native_components_publish: + needs: [native_components_publish] + runs-on: ubuntu-latest + steps: + - name: Delay for 1 minutes + run: sleep 60 plugin_publish: - needs: [analyze_and_test, platform_interface_publish, native_components_publish] + needs: [analyze_and_test, platform_interface_publish, native_components_publish, waiting-while-native_components_publish] timeout-minutes: 4 runs-on: ubuntu-latest name: mindbox publishing @@ -152,6 +166,8 @@ jobs: startsWith(github.head_ref, 'release') && github.base_ref == 'master' runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} steps: - name: Checkout develop branch uses: actions/checkout@v4 @@ -159,14 +175,10 @@ jobs: ref: develop - name: Create Pull Request run: gh pr create --base develop --head master --title "Merge 'master' into 'develop' after release" --body "Automated Pull Request to merge 'master' into 'develop' after release" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Merge Pull Request run: | pr_number=$(gh pr list --base develop --head master --json number --jq '.[0].number') - gh pr merge $pr_number --merge - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + gh pr merge $pr_number --merge --auto message-to-loop-if-success: needs: [ merge ] @@ -184,4 +196,4 @@ jobs: EOF) curl -X POST "$LOOP_NOTIFICATION_WEBHOOK_URL" \ -H "Content-Type: application/json" \ - -d "$MESSAGE" \ No newline at end of file + -d "$MESSAGE" diff --git a/.github/workflows/release-version-check.yml b/.github/workflows/release-version-check.yml index 0ccb13d..dbc9311 100644 --- a/.github/workflows/release-version-check.yml +++ b/.github/workflows/release-version-check.yml @@ -1,4 +1,4 @@ -name: release-version-check +name: Branch Protection on: pull_request: @@ -47,4 +47,4 @@ jobs: with: head: ${{ env.RELEASE_VERSION }} base: ${{ env.MASTER_VERSION }} - operator: '>' \ No newline at end of file + operator: '>' diff --git a/.github/workflows/trigger-build-app-manual.yml b/.github/workflows/trigger-build-app-manual.yml deleted file mode 100644 index 5c7ae41..0000000 --- a/.github/workflows/trigger-build-app-manual.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Build application manual - -on: - workflow_dispatch: - -jobs: - call-reusable: - uses: ./.github/workflows/trigger-build-app-reusable.yml - with: - branch: ${{ github.ref_name }} - secrets: inherit \ No newline at end of file From 0ae0fe18a4d9b9707c9cd28f9c480848f1fa5815 Mon Sep 17 00:00:00 2001 From: Sergei Semko <28645140+justSmK@users.noreply.github.com> Date: Mon, 26 May 2025 12:20:18 +0300 Subject: [PATCH 6/8] WMSDK-450: Fix distribution and tests (#159) * WMSDK-450: Fix triggers for tests and distribution Distribute PushOk by PR closed into mission/* Lint and tests only in PRs * Some fix * Add tests for mission --- .github/workflows/analyze_and_test.yml | 13 ++++--------- ...e-develop.yml => distribute-develop-mission.yml} | 8 +++++--- 2 files changed, 9 insertions(+), 12 deletions(-) rename .github/workflows/{distribute-develop.yml => distribute-develop-mission.yml} (67%) diff --git a/.github/workflows/analyze_and_test.yml b/.github/workflows/analyze_and_test.yml index 3b17713..c8bfa00 100644 --- a/.github/workflows/analyze_and_test.yml +++ b/.github/workflows/analyze_and_test.yml @@ -3,18 +3,13 @@ name: Analyzes and Tests on: push: branches: - - '**' - - '!master' - paths-ignore: - - '**.md' - tags-ignore: - - '**' - pull_request: - branches: - - master + - develop - mission/* + pull_request: types: - opened + - reopened + - synchronize workflow_call: inputs: branch: diff --git a/.github/workflows/distribute-develop.yml b/.github/workflows/distribute-develop-mission.yml similarity index 67% rename from .github/workflows/distribute-develop.yml rename to .github/workflows/distribute-develop-mission.yml index 53b1879..ad456db 100644 --- a/.github/workflows/distribute-develop.yml +++ b/.github/workflows/distribute-develop-mission.yml @@ -1,10 +1,12 @@ -name: PushOk (Develop PR Merge) +name: Distribute PushOk (Develop / Mission PR Merge) on: pull_request: - types: [closed] branches: - - 'develop' + - develop + - mission/* + types: + - closed jobs: call-reusable: From 25d820cbe1e44dfdaf506d54da5b2a9773b4c05d Mon Sep 17 00:00:00 2001 From: Egor Kitselyuk Date: Thu, 5 Jun 2025 13:03:19 +0300 Subject: [PATCH 7/8] WMSDK-435: Fix pending callbacks --- .../lib/src/types/mindbox_method_handler.dart | 92 +++++++++++-------- 1 file changed, 55 insertions(+), 37 deletions(-) diff --git a/mindbox_platform_interface/lib/src/types/mindbox_method_handler.dart b/mindbox_platform_interface/lib/src/types/mindbox_method_handler.dart index cd1ec62..14e2c6a 100644 --- a/mindbox_platform_interface/lib/src/types/mindbox_method_handler.dart +++ b/mindbox_platform_interface/lib/src/types/mindbox_method_handler.dart @@ -49,6 +49,7 @@ class MindboxMethodHandler { InAppClickHandler? _inAppClickHandler; InAppDismissedHandler? _inAppDismissedHandler; bool _methodHandlerSet = false; + Future _initFuture = Future.value(); /// Returns native SDK version. Future get nativeSdkVersion async => @@ -59,6 +60,13 @@ class MindboxMethodHandler { /// You can call this method multiple times to set new configuration params. /// Read more about [Configuration] parameter. Future init({required Configuration configuration}) async { + _initFuture = _initFuture.then((_) async { + await _init(configuration: configuration); + }); + await _initFuture; + } + + Future _init({required Configuration configuration}) async { try { //ignore: unnecessary_null_comparison if (ServicesBinding.instance == null) { @@ -73,11 +81,15 @@ class MindboxMethodHandler { _setMethodCallHandler(); } - for (final callbackMethod in _pendingCallbackMethods) { + final pendingCallbackMethodsCopy = + List<_PendingCallbackMethod>.from(_pendingCallbackMethods); + for (final callbackMethod in pendingCallbackMethodsCopy) { callbackMethod.callback( await channel.invokeMethod(callbackMethod.methodName) ?? 'null'); } - for (final operation in _pendingOperations) { + final pendingOperationsCopy = + List<_PendingOperations>.from(_pendingOperations); + for (final operation in pendingOperationsCopy) { channel.invokeMethod(operation.methodName, operation.parameters).then( (result) { if (operation.successCallback != null) { @@ -92,8 +104,8 @@ class MindboxMethodHandler { } _pendingCallbackMethods.clear(); _pendingOperations.clear(); - _initialized = true; _logInfo('Init in Flutter'); + _initialized = true; } on PlatformException catch (e) { throw MindboxInitializeError( message: e.message ?? '', data: e.details ?? ''); @@ -102,6 +114,7 @@ class MindboxMethodHandler { /// Returns device UUID to callback. void getDeviceUUID({required Function(String uuid) callback}) async { + await _initFuture; if (_initialized) { callback(await channel.invokeMethod('getDeviceUUID')); } else { @@ -112,6 +125,7 @@ class MindboxMethodHandler { /// Returns token to callback. void getToken({required Function(String token) callback}) async { + await _initFuture; if (_initialized) { callback(await channel.invokeMethod('getToken') ?? 'null'); } else { @@ -122,6 +136,7 @@ class MindboxMethodHandler { /// Returns token to callback. void getTokens({required Function(String token) callback}) async { + await _initFuture; if (_initialized) { callback(await channel.invokeMethod('getTokens') ?? 'null'); } else { @@ -143,25 +158,25 @@ class MindboxMethodHandler { /// Method for registers a list of InAppCallback instances to handle clicks /// and dismiss in in-apps. void registerInAppCallbacks({required List callbacks}) async { - final List types = []; - bool custom = false; - for (var element in callbacks) { - if (element is CustomInAppCallback) { - _inAppClickHandler = element.clickHandler; - _inAppDismissedHandler = element.dismissedHandler; - custom = true; - } - types.add(element.type); - } - - if (custom == false - && (_inAppClickHandler != null || _inAppDismissedHandler != null)) { - types.add('CustomInAppCallback'); - } - - if (types.isNotEmpty) { - await channel.invokeMethod('registerInAppCallbacks', types); - } + final List types = []; + bool custom = false; + for (var element in callbacks) { + if (element is CustomInAppCallback) { + _inAppClickHandler = element.clickHandler; + _inAppDismissedHandler = element.dismissedHandler; + custom = true; + } + types.add(element.type); + } + + if (custom == false && + (_inAppClickHandler != null || _inAppDismissedHandler != null)) { + types.add('CustomInAppCallback'); + } + + if (types.isNotEmpty) { + await channel.invokeMethod('registerInAppCallbacks', types); + } } /// Method for handling push-notification click. @@ -211,6 +226,7 @@ class MindboxMethodHandler { required String operationSystemName, required Map operationBody, }) async { + await _initFuture; if (_initialized) { channel.invokeMethod('executeAsyncOperation', [ operationSystemName, @@ -231,6 +247,7 @@ class MindboxMethodHandler { required Function(String success) onSuccess, required Function(MindboxError) onError, }) async { + await _initFuture; if (_initialized) { channel.invokeMethod('executeSyncOperation', [ operationSystemName, @@ -313,6 +330,7 @@ class MindboxMethodHandler { data: exception.message!); } } + /// Writes a log message to the native Mindbox logging system. /// [message]: The message to be logged /// [logLevel]: The severity level of the log message [LogLevel] @@ -324,9 +342,9 @@ class MindboxMethodHandler { void _setMethodCallHandler() { channel.setMethodCallHandler((call) { - switch (call.method) { - case 'pushClicked': - _logInfo('Handle method pushClicked'); + switch (call.method) { + case 'pushClicked': + _logInfo('Handle method pushClicked'); if (_pushClickHandler != null) { if (call.arguments is List) { _logInfo('Return data from push with parameters link = ' @@ -339,18 +357,18 @@ class MindboxMethodHandler { link: call.arguments[0], payload: call.arguments[1])); } break; - case 'onInAppClick': - if (call.arguments is List) { - _inAppClickHandler?.call( - call.arguments[0], call.arguments[1], call.arguments[2]); - } - break; - case 'onInAppDismissed': - if (call.arguments is String) { - _inAppDismissedHandler?.call(call.arguments); - } - break; - } + case 'onInAppClick': + if (call.arguments is List) { + _inAppClickHandler?.call( + call.arguments[0], call.arguments[1], call.arguments[2]); + } + break; + case 'onInAppDismissed': + if (call.arguments is String) { + _inAppDismissedHandler?.call(call.arguments); + } + break; + } return Future.value(true); }); _methodHandlerSet = true; From 1f3b5baafe94e8aa3b9f4b6ea29e7719efe7c3dd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Jun 2025 09:11:56 +0000 Subject: [PATCH 8/8] Bump SDK versions: Flutter=2.13.4, Android=2.13.4, iOS=2.13.4 --- mindbox/CHANGELOG.md | 5 +++++ mindbox/pubspec.yaml | 8 ++++---- mindbox_android/CHANGELOG.md | 4 ++++ mindbox_android/android/build.gradle | 2 +- mindbox_android/pubspec.yaml | 4 ++-- mindbox_ios/CHANGELOG.md | 4 ++++ mindbox_ios/ios/mindbox_ios.podspec | 6 +++--- mindbox_ios/pubspec.yaml | 4 ++-- mindbox_platform_interface/CHANGELOG.md | 5 +++++ mindbox_platform_interface/pubspec.yaml | 2 +- 10 files changed, 31 insertions(+), 13 deletions(-) diff --git a/mindbox/CHANGELOG.md b/mindbox/CHANGELOG.md index dd6b3b2..81b0ce9 100644 --- a/mindbox/CHANGELOG.md +++ b/mindbox/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.13.4 + +* Upgrade native Android SDK dependency to v2.13.4. +* Upgrade native iOS SDK dependency to v2.13.4. + ## 2.13.2-rc * Upgrade native Android SDK dependency to v2.13.2-rc. diff --git a/mindbox/pubspec.yaml b/mindbox/pubspec.yaml index 9d3eb21..390d63f 100644 --- a/mindbox/pubspec.yaml +++ b/mindbox/pubspec.yaml @@ -1,6 +1,6 @@ name: mindbox description: Flutter Mindbox SDK. Plugin wrapper over of Mindbox iOS/Android SDK. -version: 2.13.2-rc +version: 2.13.4 homepage: https://mindbox.cloud/ repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox documentation: https://developers.mindbox.ru/docs/flutter-sdk-integration @@ -20,9 +20,9 @@ flutter: dependencies: flutter: sdk: flutter - mindbox_android: ^2.13.2-rc - mindbox_ios: ^2.13.2-rc - mindbox_platform_interface: ^2.13.2-rc + mindbox_android: ^2.13.4 + mindbox_ios: ^2.13.4 + mindbox_platform_interface: ^2.13.4 dev_dependencies: flutter_test: diff --git a/mindbox_android/CHANGELOG.md b/mindbox_android/CHANGELOG.md index 21f7a99..4fd70a3 100644 --- a/mindbox_android/CHANGELOG.md +++ b/mindbox_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.13.4 + +* Upgrade native Android SDK dependency to v2.13.4. + ## 2.13.2-rc * Upgrade native Android SDK dependency to v2.13.2-rc. diff --git a/mindbox_android/android/build.gradle b/mindbox_android/android/build.gradle index a562475..2617a13 100644 --- a/mindbox_android/android/build.gradle +++ b/mindbox_android/android/build.gradle @@ -50,5 +50,5 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - api 'cloud.mindbox:mobile-sdk:2.13.2-rc' + api 'cloud.mindbox:mobile-sdk:2.13.4' } diff --git a/mindbox_android/pubspec.yaml b/mindbox_android/pubspec.yaml index fd2c637..c9bfb4b 100644 --- a/mindbox_android/pubspec.yaml +++ b/mindbox_android/pubspec.yaml @@ -1,6 +1,6 @@ name: mindbox_android description: The implementation of 'mindbox' plugin for the Android platform. -version: 2.13.2-rc +version: 2.13.4 homepage: https://mindbox.cloud/ repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_android @@ -19,7 +19,7 @@ flutter: dependencies: flutter: sdk: flutter - mindbox_platform_interface: ^2.13.2-rc + mindbox_platform_interface: ^2.13.4 dev_dependencies: flutter_test: diff --git a/mindbox_ios/CHANGELOG.md b/mindbox_ios/CHANGELOG.md index 357f44f..6fabae6 100644 --- a/mindbox_ios/CHANGELOG.md +++ b/mindbox_ios/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.13.4 + +* Upgrade native iOS SDK dependency to v2.13.4. + ## 2.13.2-rc * Upgrade native iOS SDK dependency to v2.13.2-rc. diff --git a/mindbox_ios/ios/mindbox_ios.podspec b/mindbox_ios/ios/mindbox_ios.podspec index 04e9b37..6ad908e 100644 --- a/mindbox_ios/ios/mindbox_ios.podspec +++ b/mindbox_ios/ios/mindbox_ios.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'mindbox_ios' - s.version = '2.13.2-rc' + s.version = '2.13.4' s.summary = 'Mindbox Flutter SDK' s.description = <<-DESC The implementation of 'mindbox' plugin for the iOS platform @@ -15,8 +15,8 @@ The implementation of 'mindbox' plugin for the iOS platform s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' - s.dependency 'Mindbox', '2.13.2-rc' - s.dependency 'MindboxNotifications', '2.13.2-rc' + s.dependency 'Mindbox', '2.13.4' + s.dependency 'MindboxNotifications', '2.13.4' s.platform = :ios, '12.0' # Flutter.framework does not contain a i386 slice. diff --git a/mindbox_ios/pubspec.yaml b/mindbox_ios/pubspec.yaml index b31cfc0..348f4bf 100644 --- a/mindbox_ios/pubspec.yaml +++ b/mindbox_ios/pubspec.yaml @@ -1,6 +1,6 @@ name: mindbox_ios description: The implementation of 'mindbox' plugin for the iOS platform. -version: 2.13.2-rc +version: 2.13.4 homepage: https://mindbox.cloud/ repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_ios @@ -18,7 +18,7 @@ flutter: dependencies: flutter: sdk: flutter - mindbox_platform_interface: ^2.13.2-rc + mindbox_platform_interface: ^2.13.4 dev_dependencies: flutter_test: diff --git a/mindbox_platform_interface/CHANGELOG.md b/mindbox_platform_interface/CHANGELOG.md index bb31a2e..2303b5a 100644 --- a/mindbox_platform_interface/CHANGELOG.md +++ b/mindbox_platform_interface/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.13.4 + +* Upgrade native Android SDK dependency to v2.13.4. +* Upgrade native iOS SDK dependency to v2.13.4. + ## 2.13.2-rc * Upgrade native Android SDK dependency to v2.13.2-rc. diff --git a/mindbox_platform_interface/pubspec.yaml b/mindbox_platform_interface/pubspec.yaml index c96ceab..20ec0c8 100644 --- a/mindbox_platform_interface/pubspec.yaml +++ b/mindbox_platform_interface/pubspec.yaml @@ -1,6 +1,6 @@ name: mindbox_platform_interface description: Mindbox platform interface. -version: 2.13.2-rc +version: 2.13.4 homepage: https://mindbox.cloud/ repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_platform_interface