Skip to content

Commit

Permalink
Merge pull request #398 from mindbox-cloud/release/2.10.0
Browse files Browse the repository at this point in the history
Release/2.10.0
  • Loading branch information
AndreyEmtsov authored Jun 7, 2024
2 parents 3499993 + ffb0eb6 commit 8e61be0
Show file tree
Hide file tree
Showing 20 changed files with 401 additions and 155 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,70 +28,87 @@ podspec_file="Mindbox.podspec"
notification_podspec_file="MindboxNotifications.podspec"
sdkversionprovider_file="SDKVersionProvider/SDKVersionProvider.swift"
sdkversionconfig_file="SDKVersionProvider/SDKVersionConfig.xcconfig"
logger_podspec_file="MindboxLogger.podspec"

current_version=$(grep -E '^\s+spec.version\s+=' "$podspec_file" | cut -d'"' -f2)

# Update Mindbox.podspec version
echo "`Mindbox.podspec` Before updating version:"
echo "'Mindbox.podspec' Before updating version:"
grep "spec.version" $podspec_file

sed -i '' "s/\(spec.dependency 'MindboxLogger', '\)[^']*\(\'\)/\1$version\2/g" "$podspec_file"
echo "$podspec_file dependency on MindboxLogger updated to $version."

sed -i '' "s/^\([[:space:]]*spec.version[[:space:]]*=[[:space:]]*\"\).*\(\"$\)/\1$version\2/" $podspec_file

echo "`Mindbox.podspec` After updating version:"
echo "'Mindbox.podspec' After updating version:"
grep "spec.version" $podspec_file

# Update MindboxNotifications.podspec version
echo "`MindboxNotifications.podspec` Before updating version:"
echo "'MindboxNotifications.podspec' Before updating version:"
grep "spec.version" $notification_podspec_file

sed -i '' "s/\(spec.dependency 'MindboxLogger', '\)[^']*\(\'\)/\1$version\2/g" "$notification_podspec_file"
echo "$notification_podspec_file dependency on MindboxLogger updated to $version."

sed -i '' "s/^\([[:space:]]*spec.version[[:space:]]*=[[:space:]]*\"\).*\(\"$\)/\1$version\2/" $notification_podspec_file

echo "`MindboxNotifications.podspec` After updating version:"
echo "'MindboxNotifications.podspec' After updating version:"
grep "spec.version" $notification_podspec_file

# Update SDKVersionProvider.swift version
echo "`SDKVersionProvider.swift` Before updating version:"
echo "'SDKVersionProvider.swift' Before updating version:"
grep "sdkVersion" $sdkversionprovider_file

sed -i '' "s/\(public static let sdkVersion = \"\).*\(\"$\)/\1$version\2/" $sdkversionprovider_file

echo "`SDKVersionProvider.swift` After updating version:"
echo "'SDKVersionProvider.swift' After updating version:"
grep "sdkVersion" $sdkversionprovider_file

# Update `SDKVersionConfig.xcconfig` version
echo "`SDKVersionConfig.xcconfig` Before updating version:"
# Update SDKVersionConfig.xcconfig version
echo "'SDKVersionConfig.xcconfig' Before updating version:"
grep "MARKETING_VERSION" $sdkversionconfig_file

sed -i '' "s/\(MARKETING_VERSION = \).*\$/\1$version/" $sdkversionconfig_file

echo "`SDKVersionConfig.xcconfig` After updating version:"
echo "'SDKVersionConfig.xcconfig' After updating version:"
grep "MARKETING_VERSION" $sdkversionconfig_file

# Update MindboxLogger.podspec version
echo "'MindboxLogger.podspec' Before updating version:"
grep "spec.version" $logger_podspec_file

sed -i '' "s/^\([[:space:]]*spec.version[[:space:]]*=[[:space:]]*\"\).*\(\"$\)/\1$version\2/" $logger_podspec_file

echo "'MindboxLogger.podspec' After updating version:"
grep "spec.version" $logger_podspec_file

echo "Bump SDK version from $current_version to $version."

git add $podspec_file
git add $notification_podspec_file
git add $sdkversionprovider_file
git add $sdkversionconfig_file
git add $logger_podspec_file
git commit -m "Bump SDK version from $current_version to $version"


# Update `Example/Podfile` version
# Update Example/Podfile version
podfile="Example/Podfile"

echo "`Example Podfile` Before updating version:"
echo "'Example Podfile' Before updating version:"
grep "pod 'Mindbox'" $podfile
grep "pod 'MindboxNotifications'" $podfile

sed -i '' "s/\(pod 'Mindbox', '\)[^']*\(\'\)/\1$version\2/g" $podfile
sed -i '' "s/\(pod 'MindboxNotifications', '\)[^']*\(\'\)/\1$version\2/g" $podfile

echo "`Example Podfile After` updating version:"
echo "'Example Podfile After' updating version:"
grep "pod 'Mindbox'" $podfile
grep "pod 'MindboxNotifications'" $podfile

git add $podfile
git commit -m "Bump `Example/Podfile` SDK version from $current_version to $version"
git commit -m "Bump 'Example/Podfile' SDK version from $current_version to $version"

echo "Pushing changes to branch: $current_branch"
if ! git push origin $current_branch; then
Expand Down
46 changes: 46 additions & 0 deletions .github/git-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
set -e

podspec_file="Mindbox.podspec"
version=$(grep -E '^\s+spec.version\s+=' "$podspec_file" | cut -d'"' -f2)

is_beta=false
if [[ $version == *"rc"* ]]; then
is_beta=true
fi

branch=${GITHUB_REF#refs/heads/}

echo "Version: $version"
echo "Is Beta: $is_beta"
echo "Branch: $branch"

echo "Fetching tags from remote repository."
git fetch --tags

if git rev-parse "$version" >/dev/null 2>&1; then
echo "Local tag $version already exists."
else
echo "Creating local tag $version."
git tag $version
fi

if git ls-remote --tags origin | grep -q "refs/tags/$version"; then
echo "Remote tag $version already exists."
else
echo "Pushing local tag $version to remote."
git push origin $version
fi

# Create release
release_title="Release $version"
text="Autogenerated release. Check more details at https://developers.mindbox.ru/docs/ios-sdk-integration"

echo "Release title: $release_title"
echo "Text: $text"

prerelease_flag=$([ "$is_beta" = true ] && echo "--prerelease" || echo "")

gh release create "$version" --target "$branch" --title "$release_title" --notes "$text" $prerelease_flag

echo "Release $version created for repo on branch $branch"
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- '**'
jobs:
build:
runs-on: macos-14
runs-on: macos-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/prepare_release_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ jobs:
preparation:
if: github.event.created

runs-on: macos-14
runs-on: macos-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -18,7 +19,7 @@ jobs:
run: echo "VERSION=${GITHUB_REF#refs/heads/release/}" >> $GITHUB_ENV

- name: Bump version
run: ./git-release-branch-create.sh "${{ env.VERSION }}"
run: ./.github/git-release-branch-create.sh "${{ env.VERSION }}"

- name: Check if sdkVersion matches VERSION
run: |
Expand Down Expand Up @@ -84,4 +85,4 @@ jobs:
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_MOBILE_NOTIFIER_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_MOBILE_NOTIFIER_TOKEN }}
94 changes: 85 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,114 @@ on:

jobs:
unit:
runs-on: macos-14
runs-on: macos-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Update bundler
run: gem install bundler
- name: Install bundler dependencies
run: bundle install
- name: Install yeetd
run: |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
sudo installer -pkg yeetd-normal.pkg -target /
yeetd &
- name: Run unit tests
run: bundle exec fastlane unitTestLane

logger-publish:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Update bundler
run: gem install bundler
- name: Install bundler dependencies
run: bundle install
- name: Deploy to Cocoapods MindboxLogger
run: |
pod lib lint MindboxLogger.podspec --allow-warnings
pod trunk push MindboxLogger.podspec --allow-warnings
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TOKEN }}
- name: Post to a Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'C06RXV161RA'
payload: |
{
"text": "iOS - release",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "🚀 MindboxLogger has been successfuly released."
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_MOBILE_NOTIFIER_TOKEN }}

publish:
needs: [unit]
runs-on: macos-14
needs: [logger-publish]
runs-on: macos-latest
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Delay for 2 minutes
run: sleep 120
- uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Release generation
run: ./git-release.sh "${{ github.event.head_commit.message }}" "${{secrets.GITHUBACCESSTOKEN}}" "${{secrets.GITHUBUSER}}"
run: ./.github/git-release.sh
env:
GH_TOKEN: ${{ github.token }}

- name: Update bundler
run: gem install bundler
- name: Install bundler dependencies
run: bundle install
- name: Select Xcode
run: sudo xcode-select --switch /Applications/Xcode_14.3.1.app
- name: Install yeetd
run: |
wget https://github.com/biscuitehh/yeetd/releases/download/1.0/yeetd-normal.pkg
sudo installer -pkg yeetd-normal.pkg -target /
yeetd &
- name: Run build
run: bundle exec fastlane buildLane
env:
CI: true
- name: Deploy to Cocoapods
- name: Deploy to Cocoapods Mindbox/MindboxNotifications
run: |
set -eo pipefail
pod lib lint --allow-warnings
pod trunk push Mindbox.podspec --allow-warnings
pod trunk push MindboxNotifications.podspec --allow-warnings
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TOKEN }}

merge:
needs: [publish]
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 }}
2 changes: 1 addition & 1 deletion .github/workflows/trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
trigger:
runs-on: macos-14
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use_frameworks!

target 'Example' do
pod 'Mindbox', '2.10.0-rc'
pod 'Mindbox', '2.10.0'
end

target 'MindboxNotificationServiceExtension' do
pod 'MindboxNotifications', '2.10.0-rc'
pod 'MindboxNotifications', '2.10.0'
end

target 'MindboxNotificationContentExtension' do
pod 'MindboxNotifications', '2.10.0-rc'
pod 'MindboxNotifications', '2.10.0'
end
4 changes: 2 additions & 2 deletions Mindbox.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "Mindbox"
spec.version = "2.10.0-rc"
spec.version = "2.10.0"
spec.summary = "SDK for integration with Mindbox"
spec.description = "This library allows you to integrate data transfer to Mindbox Marketing Cloud"
spec.homepage = "https://github.com/mindbox-cloud/ios-sdk"
Expand All @@ -14,6 +14,6 @@ Pod::Spec.new do |spec|
'Mindbox' => ['Mindbox/**/*.xcassets', 'Mindbox/**/*.xcdatamodeld', 'Mindbox/**/*.xcprivacy']
}
spec.swift_version = "5"
spec.dependency 'MindboxLogger', '0.0.8'
spec.dependency 'MindboxLogger', '2.10.0'

end
12 changes: 12 additions & 0 deletions Mindbox.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@
BB4D7CC72BDEC51D008E3AB8 /* Notification+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4D7CC62BDEC51D008E3AB8 /* Notification+Extensions.swift */; };
BB6563102BE3BA430090C473 /* UIApplication+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB65630F2BE3BA430090C473 /* UIApplication+Extensions.swift */; };
BBAAC17C2BB2FC9100E1E25E /* MockEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBAAC17B2BB2FC9100E1E25E /* MockEvent.swift */; };
D216DE512C0716B70020F58A /* StringExtensionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D216DE502C0716B70020F58A /* StringExtensionsTests.swift */; };
D2F7E2432BADB89900B24BB8 /* UserVisitManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2F7E2412BADB89900B24BB8 /* UserVisitManager.swift */; };
D2F7E2482BADB9EF00B24BB8 /* UserVisitManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2F7E2462BADB9EF00B24BB8 /* UserVisitManagerTests.swift */; };
D2F7E24A2BADC2AB00B24BB8 /* SessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2F7E2492BADC2AB00B24BB8 /* SessionManager.swift */; };
Expand Down Expand Up @@ -835,6 +836,7 @@
BB4D7CC62BDEC51D008E3AB8 /* Notification+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Notification+Extensions.swift"; sourceTree = "<group>"; };
BB65630F2BE3BA430090C473 /* UIApplication+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+Extensions.swift"; sourceTree = "<group>"; };
BBAAC17B2BB2FC9100E1E25E /* MockEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockEvent.swift; sourceTree = "<group>"; };
D216DE502C0716B70020F58A /* StringExtensionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringExtensionsTests.swift; sourceTree = "<group>"; };
D2F7E2412BADB89900B24BB8 /* UserVisitManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserVisitManager.swift; sourceTree = "<group>"; };
D2F7E2462BADB9EF00B24BB8 /* UserVisitManagerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserVisitManagerTests.swift; sourceTree = "<group>"; };
D2F7E2492BADC2AB00B24BB8 /* SessionManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1138,6 +1140,7 @@
313B233D25ADEA0F00A1CB72 /* MindboxTests */ = {
isa = PBXGroup;
children = (
D216DE4F2C07168D0020F58A /* Extensions */,
D2F7E2452BADB9EF00B24BB8 /* UserVisitManagerTests */,
F3D818B12A3885E00002957C /* ABTests */,
F36730192B7B6E5500DD0039 /* PushNotificationTests */,
Expand Down Expand Up @@ -2104,6 +2107,14 @@
path = OSLogWritterTests;
sourceTree = "<group>";
};
D216DE4F2C07168D0020F58A /* Extensions */ = {
isa = PBXGroup;
children = (
D216DE502C0716B70020F58A /* StringExtensionsTests.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
D2F7E2402BADB89900B24BB8 /* UserVisitManager */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3439,6 +3450,7 @@
D2F7E24C2BADC4CA00B24BB8 /* MockSessionManager.swift in Sources */,
F31470842B96355600E01E5C /* MockInAppConfigurationDataFacade.swift in Sources */,
F3A8B9982A3A421C00E9C055 /* SDKVersionValidatorTests.swift in Sources */,
D216DE512C0716B70020F58A /* StringExtensionsTests.swift in Sources */,
A17958812978B3FA00609E91 /* InAppResponseModelTests.swift in Sources */,
9B4F9E0528D0945F002C9CF0 /* InAppCoreManagerMock.swift in Sources */,
840C387F25CD15C200D50183 /* MockDataBaseLoader.swift in Sources */,
Expand Down
Loading

0 comments on commit 8e61be0

Please sign in to comment.