-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/WMSDK-547 CI/CD #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1f24aba
WMSDK-547 Added manual release branch workflow
a251f58
WMSDK-547 Updated bump version script
4a101a3
WMSDK-547 Update publish
663708c
WMSDK-547: Adds merge job to workflow
61fa5e2
WMSDK-547 Fix PR
e45e4fe
WMSDK-547 Fix PR
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,49 +1,91 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| # Check if the parameter is provided | ||
| # === Validate input === | ||
| if [ $# -eq 0 ]; then | ||
| echo "Please provide the release version number as a parameter." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check if the version number matches the semver format | ||
| if ! [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then | ||
| echo "The release version number does not match the semver format (X.Y.Z or X.Y.Z-rc)." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check the current Git branch | ||
| version=$1 | ||
| current_branch=$(git symbolic-ref --short HEAD) | ||
| echo "Currently on branch: $current_branch" | ||
| echo "→ Currently on branch: $current_branch" | ||
|
|
||
| if [[ ! $current_branch =~ ^(release|support)/[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then | ||
| 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'." | ||
| exit 1 | ||
| echo "❌ The current Git branch ($current_branch) is not in the correct format." | ||
| exit 1 | ||
| fi | ||
|
|
||
| version=$1 | ||
| # === Update gradle.properties === | ||
| properties_file="gradle.properties" | ||
| if [ ! -f "$properties_file" ]; then | ||
| echo "❌ $properties_file not found." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Show the current directory and its files | ||
| echo "Current directory: $(pwd)" | ||
| echo "Files in the current directory:" | ||
| ls -l | ||
| current_version=$(grep -E '^SDK_VERSION_NAME=' "$properties_file" | cut -d'=' -f2) | ||
| echo "→ Current SDK_VERSION_NAME: ${current_version:-<empty>}" | ||
| echo "→ Updating SDK_VERSION_NAME to $version" | ||
|
|
||
| # Add changelog to the index and create a commit | ||
| properties_file="gradle.properties" | ||
| current_version=$(grep -E '^KMP_SDK_VERSION_NAME=' gradle.properties | cut -d'=' -f2) | ||
| sed -i "s/^KMP_SDK_VERSION_NAME=.*/KMP_SDK_VERSION_NAME=$version/" $properties_file | ||
| if [[ "$OSTYPE" == "darwin"* ]]; then | ||
| sed -i '' "s/^SDK_VERSION_NAME=.*/SDK_VERSION_NAME=$version/" "$properties_file" | ||
| else | ||
| sed -i "s/^SDK_VERSION_NAME=.*/SDK_VERSION_NAME=$version/" "$properties_file" | ||
| fi | ||
|
|
||
| grep "^SDK_VERSION_NAME=" "$properties_file" | ||
| git add "$properties_file" | ||
|
|
||
| # Replace the current version with the new version in the Package.swift file | ||
| sed -i '' -E 's#(url: ")[^"]*(MindboxCommon\.xcframework\.zip)(",)#\1https://github.com/mindbox-cloud/kmp-common-sdk/releases/download/'"$VERSION"'/MindboxCommon.xcframework.zip\3#g' Package.swift | ||
| # === Update MindboxCommon.podspec (only s.version) === | ||
| podspec_file="MindboxCommon.podspec" | ||
| if [ -f "$podspec_file" ]; then | ||
| echo "→ Updating $podspec_file version to $version" | ||
|
|
||
| if [[ "$OSTYPE" == "darwin"* ]]; then | ||
| sed -i '' -E "s|^[[:space:]]*s\.version[[:space:]]*=.*| s.version = '$version'|" "$podspec_file" | ||
| else | ||
| sed -i -E "s|^[[:space:]]*s\.version[[:space:]]*=.*| s.version = '$version'|" "$podspec_file" | ||
| fi | ||
|
|
||
| echo "Bump Common SDK version from $current_version to $version." | ||
| grep "s.version" "$podspec_file" | ||
| git add "$podspec_file" | ||
| else | ||
| echo "⚠️ $podspec_file not found, skipping podspec update." | ||
| fi | ||
|
|
||
| # === Commit changes === | ||
| echo "" | ||
| git commit -m "Bump Common SDK version to $version" || echo "No changes to commit" | ||
|
|
||
| # === Validation === | ||
| echo "→ Validating version bump..." | ||
| new_version=$(grep -E '^SDK_VERSION_NAME=' "$properties_file" | cut -d'=' -f2) | ||
|
|
||
| git add $properties_file | ||
| git commit -m "Bump Common SDK version to $version" | ||
| if [ "$new_version" != "$version" ]; then | ||
| echo "❌ Validation failed: expected SDK_VERSION_NAME=$version but found $new_version" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Pushing changes to branch: $current_branch" | ||
| if ! git push origin $current_branch; then | ||
| echo "Failed to push changes to the origin $current_branch" | ||
| if [ -f "$podspec_file" ]; then | ||
| podspec_version=$(grep -E "^[[:space:]]*s\.version" "$podspec_file" | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+(-rc)?") | ||
| if [ "$podspec_version" != "$version" ]; then | ||
| echo "❌ Validation failed: expected s.version=$version but found $podspec_version" | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
| echo "✅ Validation passed: version successfully updated to $version" | ||
|
|
||
| # === Push changes === | ||
| echo "→ Pushing changes to branch: $current_branch" | ||
| if ! git push origin "$current_branch"; then | ||
| echo "❌ Failed to push changes to origin/$current_branch" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "✅ bump_versions_in_release_branch.sh completed successfully." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| name: Common SDK publish from master or support branch | ||
| name: 2. Auto Github Release | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А что за цифры, зачем они нужны?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
И названия скриптов надо оставить один в один как в других репозиториях. Чтобы легко контекст можно было переключать
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Продолжительная идея в том, чтобы при пине в Github Actions этот воркфлоу был наверху, так как это первый шаг
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут обсудили на дэйли, хотим попробовать такой формат в KMP, если приживется поправим везде. Дэдлайн пару месяцев