From 32ed65643bee8d72e825b102a2d1cd18d9798793 Mon Sep 17 00:00:00 2001 From: Sergei Semko <28645140+justSmK@users.noreply.github.com> Date: Mon, 26 Jan 2026 12:03:41 +0300 Subject: [PATCH 1/2] WMSDK-608: Update distribution flow (#185) Solution without GItLab API token With manual distribution, you can specify the branch name for the app. If there is no such branch, the workflow will fail and the logs will show an error stating that the branch could not be found. In all other cases, I always try to trigger a build on GitLab with the exact same branch as the one on which the distribution workflow runs. If there is no such branch, it triggers a build in GitLab on develop. --- .github/workflows/distribute-manual.yml | 8 +- .github/workflows/distribute-reusable.yml | 179 ++++++++++++++++++++-- 2 files changed, 177 insertions(+), 10 deletions(-) diff --git a/.github/workflows/distribute-manual.yml b/.github/workflows/distribute-manual.yml index 8c21bc7..13984e5 100644 --- a/.github/workflows/distribute-manual.yml +++ b/.github/workflows/distribute-manual.yml @@ -2,10 +2,16 @@ name: Distribute PushOk (manual) on: workflow_dispatch: + inputs: + app_ref: + description: "GitLab App branch (optional)" + required: false + default: "" jobs: call-reusable: uses: ./.github/workflows/distribute-reusable.yml with: - branch: ${{ github.ref_name }} + branch: ${{ github.ref_name }} # SDK branch = current branch + app_ref: ${{ inputs.app_ref }} # optional override for GitLab ref secrets: inherit diff --git a/.github/workflows/distribute-reusable.yml b/.github/workflows/distribute-reusable.yml index 310feae..98a72fb 100644 --- a/.github/workflows/distribute-reusable.yml +++ b/.github/workflows/distribute-reusable.yml @@ -6,25 +6,186 @@ on: branch: required: true type: string + app_ref: + required: false + type: string + default: "" + secrets: + GITLAB_TRIGGER_TOKEN: + required: true jobs: trigger: - runs-on: macos-latest + runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: ref: ${{ inputs.branch }} + fetch-depth: 3 - name: Get last 3 commit messages + shell: bash + run: | + set -euo pipefail + commits="$(git log -3 --pretty=format:"%s")" + echo "commits<> "$GITHUB_ENV" + echo "$commits" >> "$GITHUB_ENV" + echo "EOF" >> "$GITHUB_ENV" + + - name: Debug payload that will be sent to GitLab + shell: bash + env: + SOURCE_BRANCH: ${{ inputs.branch }} + APP_REF_OVERRIDE: ${{ inputs.app_ref }} + DEFAULT_APP_REF: develop + INPUT_COMMITS: ${{ env.commits }} run: | - commits=$(git log -3 --pretty=format:"%s") - echo "commits=$commits" >> $GITHUB_ENV + set -euo pipefail + + APP_REF_OVERRIDE="$(printf '%s' "${APP_REF_OVERRIDE:-}" | xargs)" + + echo "---- DEBUG (GitHub -> GitLab trigger payload) ----" + echo "SDK branch (INPUT_BRANCH): $SOURCE_BRANCH" + echo "Manual App ref override: ${APP_REF_OVERRIDE:-}" + echo "Default App ref: $DEFAULT_APP_REF" + echo "" + echo "RAW INPUT_COMMITS (cat -A):" + printf '%s' "${INPUT_COMMITS:-}" | cat -A + echo "" + echo "RAW INPUT_COMMITS (printf %q):" + printf '%q\n' "${INPUT_COMMITS:-}" + echo "--------------------------------------------------" + + - name: Trigger build workflow in flutter-app repo (override strict; else same->develop) + shell: bash + env: + GITLAB_HOST: mindbox.gitlab.yandexcloud.net + APP_PROJECT_ID: "1089" + DEFAULT_APP_REF: develop + + SOURCE_BRANCH: ${{ inputs.branch }} + APP_REF_OVERRIDE: ${{ inputs.app_ref }} - - name: Trigger build workflow in flutter-app repo + GITLAB_TRIGGER_TOKEN: ${{ secrets.GITLAB_TRIGGER_TOKEN }} + INPUT_COMMITS: ${{ env.commits }} 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 }}" + set -euo pipefail + + APP_REF_OVERRIDE="$(printf '%s' "${APP_REF_OVERRIDE:-}" | xargs)" + + normalize_commits() { + local raw="${1:-}" + raw="$(printf '%s' "$raw" | tr -d '\r')" + if [[ "$raw" == *"\\n"* ]]; then + raw="$(printf '%b' "$raw")" + fi + printf '%s' "$raw" + } + + COMMITS_TO_SEND="$(normalize_commits "${INPUT_COMMITS:-}")" + + trigger_pipeline() { + local ref="$1" + local tmp_body + tmp_body="$(mktemp)" + + local code + code="$(curl -sS -o "$tmp_body" -w '%{http_code}' --location \ + --retry 3 --retry-all-errors --retry-delay 2 \ + "https://${GITLAB_HOST}/api/v4/projects/${APP_PROJECT_ID}/trigger/pipeline" \ + --form "token=${GITLAB_TRIGGER_TOKEN}" \ + --form "ref=${ref}" \ + --form "variables[INPUT_BRANCH]=${SOURCE_BRANCH}" \ + --form "variables[INPUT_COMMITS]=${COMMITS_TO_SEND}")" + + local body + body="$(cat "$tmp_body" 2>/dev/null || true)" + rm -f "$tmp_body" + + echo "Trigger HTTP: $code (ref=$ref)" + echo "Response body:" + echo "$body" + + if [[ "$code" == "200" || "$code" == "201" ]]; then + local web_url + web_url="$( + printf '%s\n' "$body" | + grep -o '"web_url":"[^"]*"' | + head -n 1 | + cut -d'"' -f4 + )" + if [[ -n "${web_url:-}" ]]; then + echo "Pipeline URL: $web_url" + fi + return 0 + fi + + if [[ "$code" == "401" || "$code" == "403" ]]; then + echo "Auth error (HTTP $code). Check that GITLAB_TRIGGER_TOKEN is valid and has access to project ${APP_PROJECT_ID}." + return 1 + fi + + if [[ "$code" == "400" || "$code" == "404" ]]; then + if [[ "$body" == *"Reference not found"* ]]; then + return 2 + fi + echo "Got HTTP $code but it's NOT 'Reference not found'." + echo "This can happen if pipelines are blocked for triggers by workflow:rules or job rules when CI_PIPELINE_SOURCE == 'trigger'." + echo "Check the target repo .gitlab-ci.yml rules/workflow:rules." + return 1 + fi + + if [[ "$code" =~ ^5[0-9][0-9]$ ]]; then + echo "Server error (HTTP $code). GitLab/proxy might be temporarily unavailable." + return 1 + fi + + echo "Unexpected HTTP status: $code" + return 1 + } + + echo "SDK branch (INPUT_BRANCH): $SOURCE_BRANCH" + echo "Manual App ref override: ${APP_REF_OVERRIDE:-}" + echo "Default App ref: $DEFAULT_APP_REF" + + if [[ -n "$APP_REF_OVERRIDE" ]]; then + echo "Override provided -> trying ONLY App ref: $APP_REF_OVERRIDE" + trigger_pipeline "$APP_REF_OVERRIDE" || rc=$? + rc="${rc:-0}" + + if [[ "$rc" == "0" ]]; then + echo "Triggered on override ref." + exit 0 + fi + + if [[ "$rc" == "2" ]]; then + echo "ERROR: App ref not found: $APP_REF_OVERRIDE (GitLab returned 'Reference not found')" + exit 1 + fi + + echo "ERROR: Trigger failed for reasons other than missing ref." + exit 1 + fi + + desired_ref="$SOURCE_BRANCH" + fallback_ref="$DEFAULT_APP_REF" + + echo "No override -> trying App ref: $desired_ref" + trigger_pipeline "$desired_ref" || rc=$? + rc="${rc:-0}" + + if [[ "$rc" == "0" ]]; then + echo "Triggered on same branch." + exit 0 + fi + + if [[ "$rc" == "2" ]]; then + echo "Same branch not found. Falling back to: $fallback_ref" + trigger_pipeline "$fallback_ref" + echo "Triggered on fallback ref." + exit 0 + fi + + echo "ERROR: Trigger failed for reasons other than missing ref." + exit 1 From 1040871ea106d0940330b4a34889a53a95a96520 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 10:12:38 +0000 Subject: [PATCH 2/2] Bump SDK versions: Flutter=2.15.0, Android=2.15.0, iOS=2.15.0 --- 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 d47a02c..245a823 100644 --- a/mindbox/CHANGELOG.md +++ b/mindbox/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.15.0 + +* Upgrade native Android SDK dependency to v2.15.0. +* Upgrade native iOS SDK dependency to v2.15.0. + ## 2.14.5 * Upgrade native Android SDK dependency to v2.14.5. diff --git a/mindbox/pubspec.yaml b/mindbox/pubspec.yaml index 0f47977..b50f349 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.14.5 +version: 2.15.0 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.14.5 - mindbox_ios: ^2.14.5 - mindbox_platform_interface: ^2.14.5 + mindbox_android: ^2.15.0 + mindbox_ios: ^2.15.0 + mindbox_platform_interface: ^2.15.0 dev_dependencies: flutter_test: diff --git a/mindbox_android/CHANGELOG.md b/mindbox_android/CHANGELOG.md index 75da94a..d181056 100644 --- a/mindbox_android/CHANGELOG.md +++ b/mindbox_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.15.0 + +* Upgrade native Android SDK dependency to v2.15.0. + ## 2.14.5 * Upgrade native Android SDK dependency to v2.14.5. diff --git a/mindbox_android/android/build.gradle b/mindbox_android/android/build.gradle index 352911e..ab233ee 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.14.5' + api 'cloud.mindbox:mobile-sdk:2.15.0' } diff --git a/mindbox_android/pubspec.yaml b/mindbox_android/pubspec.yaml index 60c27ed..edb00eb 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.14.5 +version: 2.15.0 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.14.5 + mindbox_platform_interface: ^2.15.0 dev_dependencies: flutter_test: diff --git a/mindbox_ios/CHANGELOG.md b/mindbox_ios/CHANGELOG.md index 22d9c08..75f1298 100644 --- a/mindbox_ios/CHANGELOG.md +++ b/mindbox_ios/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.15.0 + +* Upgrade native iOS SDK dependency to v2.15.0. + ## 2.14.5 * Upgrade native iOS SDK dependency to v2.14.5. diff --git a/mindbox_ios/ios/mindbox_ios.podspec b/mindbox_ios/ios/mindbox_ios.podspec index 5be991f..53b054d 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.14.5' + s.version = '2.15.0' 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.14.5' - s.dependency 'MindboxNotifications', '2.14.5' + s.dependency 'Mindbox', '2.15.0' + s.dependency 'MindboxNotifications', '2.15.0' 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 e2ca85d..1c80597 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.14.5 +version: 2.15.0 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.14.5 + mindbox_platform_interface: ^2.15.0 dev_dependencies: flutter_test: diff --git a/mindbox_platform_interface/CHANGELOG.md b/mindbox_platform_interface/CHANGELOG.md index af7f752..90521dc 100644 --- a/mindbox_platform_interface/CHANGELOG.md +++ b/mindbox_platform_interface/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.15.0 + +* Upgrade native Android SDK dependency to v2.15.0. +* Upgrade native iOS SDK dependency to v2.15.0. + ## 2.14.5 * Upgrade native Android SDK dependency to v2.14.5. diff --git a/mindbox_platform_interface/pubspec.yaml b/mindbox_platform_interface/pubspec.yaml index 2e9fcff..d8b0888 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.14.5 +version: 2.15.0 homepage: https://mindbox.cloud/ repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_platform_interface