Skip to content

Commit 50d8615

Browse files
authored
Merge pull request #186 from mindbox-cloud/release/2.15.0
Release 2.15.0
2 parents 200b1e7 + 1040871 commit 50d8615

12 files changed

Lines changed: 208 additions & 23 deletions

File tree

.github/workflows/distribute-manual.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ name: Distribute PushOk (manual)
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
app_ref:
7+
description: "GitLab App branch (optional)"
8+
required: false
9+
default: ""
510

611
jobs:
712
call-reusable:
813
uses: ./.github/workflows/distribute-reusable.yml
914
with:
10-
branch: ${{ github.ref_name }}
15+
branch: ${{ github.ref_name }} # SDK branch = current branch
16+
app_ref: ${{ inputs.app_ref }} # optional override for GitLab ref
1117
secrets: inherit

.github/workflows/distribute-reusable.yml

Lines changed: 170 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,186 @@ on:
66
branch:
77
required: true
88
type: string
9+
app_ref:
10+
required: false
11+
type: string
12+
default: ""
13+
secrets:
14+
GITLAB_TRIGGER_TOKEN:
15+
required: true
916

1017
jobs:
1118
trigger:
12-
runs-on: macos-latest
19+
runs-on: ubuntu-latest
1320
steps:
1421
- name: Checkout repository
1522
uses: actions/checkout@v4
1623
with:
1724
ref: ${{ inputs.branch }}
25+
fetch-depth: 3
1826

1927
- name: Get last 3 commit messages
28+
shell: bash
29+
run: |
30+
set -euo pipefail
31+
commits="$(git log -3 --pretty=format:"%s")"
32+
echo "commits<<EOF" >> "$GITHUB_ENV"
33+
echo "$commits" >> "$GITHUB_ENV"
34+
echo "EOF" >> "$GITHUB_ENV"
35+
36+
- name: Debug payload that will be sent to GitLab
37+
shell: bash
38+
env:
39+
SOURCE_BRANCH: ${{ inputs.branch }}
40+
APP_REF_OVERRIDE: ${{ inputs.app_ref }}
41+
DEFAULT_APP_REF: develop
42+
INPUT_COMMITS: ${{ env.commits }}
2043
run: |
21-
commits=$(git log -3 --pretty=format:"%s")
22-
echo "commits=$commits" >> $GITHUB_ENV
44+
set -euo pipefail
45+
46+
APP_REF_OVERRIDE="$(printf '%s' "${APP_REF_OVERRIDE:-}" | xargs)"
47+
48+
echo "---- DEBUG (GitHub -> GitLab trigger payload) ----"
49+
echo "SDK branch (INPUT_BRANCH): $SOURCE_BRANCH"
50+
echo "Manual App ref override: ${APP_REF_OVERRIDE:-<empty>}"
51+
echo "Default App ref: $DEFAULT_APP_REF"
52+
echo ""
53+
echo "RAW INPUT_COMMITS (cat -A):"
54+
printf '%s' "${INPUT_COMMITS:-}" | cat -A
55+
echo ""
56+
echo "RAW INPUT_COMMITS (printf %q):"
57+
printf '%q\n' "${INPUT_COMMITS:-}"
58+
echo "--------------------------------------------------"
59+
60+
- name: Trigger build workflow in flutter-app repo (override strict; else same->develop)
61+
shell: bash
62+
env:
63+
GITLAB_HOST: mindbox.gitlab.yandexcloud.net
64+
APP_PROJECT_ID: "1089"
65+
DEFAULT_APP_REF: develop
66+
67+
SOURCE_BRANCH: ${{ inputs.branch }}
68+
APP_REF_OVERRIDE: ${{ inputs.app_ref }}
2369

24-
- name: Trigger build workflow in flutter-app repo
70+
GITLAB_TRIGGER_TOKEN: ${{ secrets.GITLAB_TRIGGER_TOKEN }}
71+
INPUT_COMMITS: ${{ env.commits }}
2572
run: |
26-
curl --location 'https://mindbox.gitlab.yandexcloud.net/api/v4/projects/1089/trigger/pipeline' \
27-
--form "token=${{ secrets.GITLAB_TRIGGER_TOKEN }}" \
28-
--form "ref=develop" \
29-
--form "variables[INPUT_BRANCH]=${{ inputs.branch }}" \
30-
--form "variables[INPUT_COMMITS]=${{ env.commits }}"
73+
set -euo pipefail
74+
75+
APP_REF_OVERRIDE="$(printf '%s' "${APP_REF_OVERRIDE:-}" | xargs)"
76+
77+
normalize_commits() {
78+
local raw="${1:-}"
79+
raw="$(printf '%s' "$raw" | tr -d '\r')"
80+
if [[ "$raw" == *"\\n"* ]]; then
81+
raw="$(printf '%b' "$raw")"
82+
fi
83+
printf '%s' "$raw"
84+
}
85+
86+
COMMITS_TO_SEND="$(normalize_commits "${INPUT_COMMITS:-}")"
87+
88+
trigger_pipeline() {
89+
local ref="$1"
90+
local tmp_body
91+
tmp_body="$(mktemp)"
92+
93+
local code
94+
code="$(curl -sS -o "$tmp_body" -w '%{http_code}' --location \
95+
--retry 3 --retry-all-errors --retry-delay 2 \
96+
"https://${GITLAB_HOST}/api/v4/projects/${APP_PROJECT_ID}/trigger/pipeline" \
97+
--form "token=${GITLAB_TRIGGER_TOKEN}" \
98+
--form "ref=${ref}" \
99+
--form "variables[INPUT_BRANCH]=${SOURCE_BRANCH}" \
100+
--form "variables[INPUT_COMMITS]=${COMMITS_TO_SEND}")"
101+
102+
local body
103+
body="$(cat "$tmp_body" 2>/dev/null || true)"
104+
rm -f "$tmp_body"
105+
106+
echo "Trigger HTTP: $code (ref=$ref)"
107+
echo "Response body:"
108+
echo "$body"
109+
110+
if [[ "$code" == "200" || "$code" == "201" ]]; then
111+
local web_url
112+
web_url="$(
113+
printf '%s\n' "$body" |
114+
grep -o '"web_url":"[^"]*"' |
115+
head -n 1 |
116+
cut -d'"' -f4
117+
)"
118+
if [[ -n "${web_url:-}" ]]; then
119+
echo "Pipeline URL: $web_url"
120+
fi
121+
return 0
122+
fi
123+
124+
if [[ "$code" == "401" || "$code" == "403" ]]; then
125+
echo "Auth error (HTTP $code). Check that GITLAB_TRIGGER_TOKEN is valid and has access to project ${APP_PROJECT_ID}."
126+
return 1
127+
fi
128+
129+
if [[ "$code" == "400" || "$code" == "404" ]]; then
130+
if [[ "$body" == *"Reference not found"* ]]; then
131+
return 2
132+
fi
133+
echo "Got HTTP $code but it's NOT 'Reference not found'."
134+
echo "This can happen if pipelines are blocked for triggers by workflow:rules or job rules when CI_PIPELINE_SOURCE == 'trigger'."
135+
echo "Check the target repo .gitlab-ci.yml rules/workflow:rules."
136+
return 1
137+
fi
138+
139+
if [[ "$code" =~ ^5[0-9][0-9]$ ]]; then
140+
echo "Server error (HTTP $code). GitLab/proxy might be temporarily unavailable."
141+
return 1
142+
fi
143+
144+
echo "Unexpected HTTP status: $code"
145+
return 1
146+
}
147+
148+
echo "SDK branch (INPUT_BRANCH): $SOURCE_BRANCH"
149+
echo "Manual App ref override: ${APP_REF_OVERRIDE:-<empty>}"
150+
echo "Default App ref: $DEFAULT_APP_REF"
151+
152+
if [[ -n "$APP_REF_OVERRIDE" ]]; then
153+
echo "Override provided -> trying ONLY App ref: $APP_REF_OVERRIDE"
154+
trigger_pipeline "$APP_REF_OVERRIDE" || rc=$?
155+
rc="${rc:-0}"
156+
157+
if [[ "$rc" == "0" ]]; then
158+
echo "Triggered on override ref."
159+
exit 0
160+
fi
161+
162+
if [[ "$rc" == "2" ]]; then
163+
echo "ERROR: App ref not found: $APP_REF_OVERRIDE (GitLab returned 'Reference not found')"
164+
exit 1
165+
fi
166+
167+
echo "ERROR: Trigger failed for reasons other than missing ref."
168+
exit 1
169+
fi
170+
171+
desired_ref="$SOURCE_BRANCH"
172+
fallback_ref="$DEFAULT_APP_REF"
173+
174+
echo "No override -> trying App ref: $desired_ref"
175+
trigger_pipeline "$desired_ref" || rc=$?
176+
rc="${rc:-0}"
177+
178+
if [[ "$rc" == "0" ]]; then
179+
echo "Triggered on same branch."
180+
exit 0
181+
fi
182+
183+
if [[ "$rc" == "2" ]]; then
184+
echo "Same branch not found. Falling back to: $fallback_ref"
185+
trigger_pipeline "$fallback_ref"
186+
echo "Triggered on fallback ref."
187+
exit 0
188+
fi
189+
190+
echo "ERROR: Trigger failed for reasons other than missing ref."
191+
exit 1

mindbox/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 2.15.0
2+
3+
* Upgrade native Android SDK dependency to v2.15.0.
4+
* Upgrade native iOS SDK dependency to v2.15.0.
5+
16
## 2.14.5
27

38
* Upgrade native Android SDK dependency to v2.14.5.

mindbox/pubspec.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: mindbox
22
description: Flutter Mindbox SDK. Plugin wrapper over of Mindbox iOS/Android SDK.
3-
version: 2.14.5
3+
version: 2.15.0
44
homepage: https://mindbox.cloud/
55
repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox
66
documentation: https://developers.mindbox.ru/docs/flutter-sdk-integration
@@ -20,9 +20,9 @@ flutter:
2020
dependencies:
2121
flutter:
2222
sdk: flutter
23-
mindbox_android: ^2.14.5
24-
mindbox_ios: ^2.14.5
25-
mindbox_platform_interface: ^2.14.5
23+
mindbox_android: ^2.15.0
24+
mindbox_ios: ^2.15.0
25+
mindbox_platform_interface: ^2.15.0
2626

2727
dev_dependencies:
2828
flutter_test:

mindbox_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.15.0
2+
3+
* Upgrade native Android SDK dependency to v2.15.0.
4+
15
## 2.14.5
26

37
* Upgrade native Android SDK dependency to v2.14.5.

mindbox_android/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ android {
5050

5151
dependencies {
5252
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
53-
api 'cloud.mindbox:mobile-sdk:2.14.5'
53+
api 'cloud.mindbox:mobile-sdk:2.15.0'
5454
}

mindbox_android/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: mindbox_android
22
description: The implementation of 'mindbox' plugin for the Android platform.
3-
version: 2.14.5
3+
version: 2.15.0
44
homepage: https://mindbox.cloud/
55
repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_android
66

@@ -19,7 +19,7 @@ flutter:
1919
dependencies:
2020
flutter:
2121
sdk: flutter
22-
mindbox_platform_interface: ^2.14.5
22+
mindbox_platform_interface: ^2.15.0
2323

2424
dev_dependencies:
2525
flutter_test:

mindbox_ios/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.15.0
2+
3+
* Upgrade native iOS SDK dependency to v2.15.0.
4+
15
## 2.14.5
26

37
* Upgrade native iOS SDK dependency to v2.14.5.

mindbox_ios/ios/mindbox_ios.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
Pod::Spec.new do |s|
66
s.name = 'mindbox_ios'
7-
s.version = '2.14.5'
7+
s.version = '2.15.0'
88
s.summary = 'Mindbox Flutter SDK'
99
s.description = <<-DESC
1010
The implementation of 'mindbox' plugin for the iOS platform
@@ -15,8 +15,8 @@ The implementation of 'mindbox' plugin for the iOS platform
1515
s.source = { :path => '.' }
1616
s.source_files = 'Classes/**/*'
1717
s.dependency 'Flutter'
18-
s.dependency 'Mindbox', '2.14.5'
19-
s.dependency 'MindboxNotifications', '2.14.5'
18+
s.dependency 'Mindbox', '2.15.0'
19+
s.dependency 'MindboxNotifications', '2.15.0'
2020
s.platform = :ios, '12.0'
2121

2222
# Flutter.framework does not contain a i386 slice.

mindbox_ios/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: mindbox_ios
22
description: The implementation of 'mindbox' plugin for the iOS platform.
3-
version: 2.14.5
3+
version: 2.15.0
44
homepage: https://mindbox.cloud/
55
repository: https://github.com/mindbox-cloud/flutter-sdk/tree/master/mindbox_ios
66

@@ -18,7 +18,7 @@ flutter:
1818
dependencies:
1919
flutter:
2020
sdk: flutter
21-
mindbox_platform_interface: ^2.14.5
21+
mindbox_platform_interface: ^2.15.0
2222

2323
dev_dependencies:
2424
flutter_test:

0 commit comments

Comments
 (0)