Skip to content

Commit 71661f3

Browse files
authored
Merge pull request #550 from mindbox-cloud/release/2.13.0-rc
Release/2.13.0-rc
2 parents 04ee59e + 1cf7d8a commit 71661f3

File tree

107 files changed

+2599
-545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+2599
-545
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
# Check if the parameter is provided
4+
if [ $# -eq 0 ]; then
5+
echo "Please provide the release version number as a parameter."
6+
exit 1
7+
fi
8+
9+
# Check if the version number matches the semver format
10+
if ! [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then
11+
echo "The release version number does not match the semver format (X.Y.Z or X.Y.Z-rc)."
12+
exit 1
13+
fi
14+
15+
# Check the current Git branch
16+
current_branch=$(git symbolic-ref --short HEAD)
17+
echo "Currently on branch: $current_branch"
18+
19+
if [[ ! $current_branch =~ ^(release|support)/[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then
20+
echo "The current Git branch ($current_branch) is not in the format 'release/X.Y.Z', 'release/X.Y.Z-rc', 'support/X.Y.Z' or 'support/X.Y.Z-rc'."
21+
exit 1
22+
fi
23+
24+
version=$1
25+
26+
# Show the current directory and its files
27+
echo "Current directory: $(pwd)"
28+
echo "Files in the current directory:"
29+
ls -l
30+
31+
# Add changelog to the index and create a commit
32+
properties_file="gradle.properties"
33+
current_version=$(grep -E '^SDK_VERSION_NAME=' gradle.properties | cut -d'=' -f2)
34+
sed -i "s/^SDK_VERSION_NAME=.*/SDK_VERSION_NAME=$version/" $properties_file
35+
sed -i "s/^SDK_VERSION_NAME=.*/SDK_VERSION_NAME=$version/" $properties_file
36+
build_gradle_example_path="example/app/build.gradle"
37+
sed -i -E "s/cloud.mindbox:mobile-sdk:[0-9]+\.[0-9]+\.[0-9]+(-rc)?/cloud.mindbox:mobile-sdk:$version/" $build_gradle_example_path
38+
39+
echo "Bump SDK version from $current_version to $version."
40+
41+
git add $properties_file
42+
git add -f $build_gradle_example_path
43+
git commit -m "Bump SDK version to $version"
44+
45+
echo "Pushing changes to branch: $current_branch"
46+
if ! git push origin $current_branch; then
47+
echo "Failed to push changes to the origin $current_branch"
48+
exit 1
49+
fi

.github/git-release-ci.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
set -e
3+
4+
version=$(grep '^SDK_VERSION_NAME=' gradle.properties | cut -d '=' -f2)
5+
6+
is_beta=false
7+
if [[ $version == *"rc"* ]]; then
8+
is_beta=true
9+
fi
10+
11+
branch=${GITHUB_REF#refs/heads/}
12+
13+
echo "Version: $version"
14+
echo "Is Beta: $is_beta"
15+
echo "Branch: $branch"
16+
17+
echo "Fetching tags from remote repository."
18+
git fetch --tags
19+
20+
if git rev-parse "$version" >/dev/null 2>&1; then
21+
echo "Local tag $version already exists."
22+
else
23+
echo "Creating local tag $version."
24+
git tag $version
25+
fi
26+
27+
if git ls-remote --tags origin | grep -q "refs/tags/$version"; then
28+
echo "Remote tag $version already exists."
29+
else
30+
echo "Pushing local tag $version to remote."
31+
git push origin $version
32+
fi
33+
34+
# Create release
35+
release_title="Release $version"
36+
text="Autogenerated release. Check more details at [Mindbox SDK Documentation](https://developers.mindbox.ru/docs/androidhuawei-native-sdk)"
37+
38+
echo "Release title: $release_title"
39+
echo "Text: $text"
40+
41+
prerelease_flag=$([ "$is_beta" = true ] && echo "--prerelease" || echo "")
42+
43+
gh release create "$version" --target "$branch" --title "$release_title" --notes "$text" $prerelease_flag
44+
45+
echo "Release $version created for repo on branch $branch"

.github/workflows/deploy.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Distribute PushOk
2+
3+
on:
4+
pull_request:
5+
types: [ closed ]
6+
branches:
7+
- develop
8+
push:
9+
branches:
10+
- 'release/*'
11+
- 'support/*'
12+
13+
jobs:
14+
distribution:
15+
if: github.event.pull_request.merged == true || (github.event_name == 'push' && (startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/support/')))
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Get last 3 commit messages
22+
run: |
23+
commits=$(git log -3 --pretty=format:"%s")
24+
echo "commits=$commits" >> $GITHUB_ENV
25+
26+
- name: Trigger build & send to FAD
27+
run: |
28+
curl --location 'https://mindbox.gitlab.yandexcloud.net/api/v4/projects/900/trigger/pipeline' \
29+
--form 'token="${{ secrets.GITLAB_TRIGGER_TOKEN }}"' \
30+
--form 'ref="develop"' \
31+
--form "variables[INPUT_BRANCH]=\"${{ github.head_ref || github.ref_name }}\"" \
32+
--form "variables[INPUT_COMMITS]=\"${{ env.commits }}\""

.github/workflows/build.yml renamed to .github/workflows/lint_unitTests_build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: SDK CI
1+
name: Lint + UnitTests + Build
22

33
on:
44
push:
@@ -7,7 +7,9 @@ on:
77
- '!master'
88
paths-ignore:
99
- '**.md'
10-
10+
tags-ignore:
11+
- '**'
12+
1113
jobs:
1214
lint:
1315
runs-on: ubuntu-latest
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Prepare release branch
2+
3+
on:
4+
push:
5+
branches:
6+
- 'release/*.*.*'
7+
- 'support/*.*.*'
8+
9+
jobs:
10+
extract_version:
11+
if: github.event.created
12+
name: Extract Version
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version: ${{ steps.extract.outputs.version }}
16+
steps:
17+
- name: Extract version from branch name
18+
id: extract
19+
run: |
20+
BRANCH_NAME="${{ github.ref_name }}"
21+
echo "BRANCH_NAME: $BRANCH_NAME"
22+
VERSION="${BRANCH_NAME#release/}"
23+
VERSION="${VERSION#support/}"
24+
echo "VERSION: $VERSION"
25+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
26+
27+
bump_version:
28+
name: Bump Version
29+
runs-on: ubuntu-latest
30+
needs: extract_version
31+
outputs:
32+
version2: ${{ steps.bump.outputs.version2 }}
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Configure Git identity for GitHub Action Bot
38+
run: |
39+
git config user.name "github-actions[bot]"
40+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
41+
42+
- name: Bump version
43+
run: ./.github/bump_versions_in_release_branch.sh "${{ needs.extract_version.outputs.version }}"
44+
45+
- name: Ouput version
46+
id: bump
47+
run: |
48+
echo "version2=${{ needs.extract_version.outputs.version }}" >> $GITHUB_OUTPUT
49+
50+
check_sdk_version:
51+
name: Check SDK Version
52+
runs-on: ubuntu-latest
53+
needs: bump_version
54+
steps:
55+
- name: Checkout code
56+
uses: actions/checkout@v4
57+
with:
58+
fetch-depth: 0
59+
60+
- name: Pull latest changes
61+
run: git pull
62+
63+
- name: Check if SDK_VERSION_NAME matches VERSION
64+
run: |
65+
SDK_VERSION=$(grep '^SDK_VERSION_NAME=' gradle.properties | cut -d '=' -f2)
66+
EXPECTED_VERSION=${{ needs.bump_version.outputs.version2 }}
67+
68+
if [ "$SDK_VERSION" != "$EXPECTED_VERSION" ]; then
69+
echo "SDK_VERSION_NAME ($ACTUAL_VERSION) does not match the expected version ($EXPECTED_VERSION)."
70+
exit 1
71+
fi
72+
shell: bash
73+
74+
create_pull_request:
75+
name: Create Pull Request
76+
runs-on: ubuntu-latest
77+
needs: check_sdk_version
78+
steps:
79+
- name: Checkout code
80+
uses: actions/checkout@v4
81+
82+
- name: Create Pull Request
83+
run: |
84+
gh pr create \
85+
--base master \
86+
--head ${{ github.ref_name }} \
87+
--title "${{ github.ref_name }}" \
88+
--body "Updates the release version to ${{ github.ref_name }}"
89+
PR_URL=$(gh pr view --json url --jq '.url')
90+
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
91+
env:
92+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+

0 commit comments

Comments
 (0)