From d56ece53d211e1ea65360b92891c3a05490512d6 Mon Sep 17 00:00:00 2001 From: Akylbek Utekeshev Date: Mon, 13 May 2024 17:44:47 +0500 Subject: [PATCH 1/3] MBX-3346 Publish ready to test --- .github/workflows/publish.yml | 60 +++++++++++++++++------------ git-logger-release-branch-create.sh | 10 ++--- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8dc84d89..f85d4f0f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,7 +5,6 @@ on: branches: - 'master' - 'support/*' - - 'feature/MBX-3346-MindboxLoggerCI' tags-ignore: - '**' @@ -34,38 +33,46 @@ jobs: run: | set -eo pipefail pod lib lint --allow-warnings - exit 1 + output=$(pod trunk push Mindbox.podspec --allow-warnings 2>&1) + echo "$output" + if echo "$output" | grep -q "Unable to accept duplicate entry for: MindboxLogger"; then + echo "Обнаружен дубликат версии, пропускаем публикацию." + exit 0 + else + echo "Ошибка при публикации, требуется вмешательство." + echo "$output" + exit 1 + fi env: COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TOKEN }} - # - name: Post to a Slack channel - # id: slack - # uses: slackapi/slack-github-action@v1.26.0 - # with: - # channel-id: 'C06RXV161RA' - # payload: | - # { - # "text": "iOS - MindboxLogger release", - # "blocks": [ - # { - # "type": "header", - # "text": { - # "type": "plain_text", - # "text": "🚀 MindboxLogger tested." - # } - # } - # ] - # } - # env: - # SLACK_BOT_TOKEN: ${{ secrets.SLACK_MOBILE_NOTIFIER_TOKEN }} + - name: Post to a Slack channel + id: slack + uses: slackapi/slack-github-action@v1.26.0 + with: + channel-id: 'C06RXV161RA' + payload: | + { + "text": "iOS - MindboxLogger release", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "🚀 MindboxLogger tested." + } + } + ] + } + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_MOBILE_NOTIFIER_TOKEN }} publish: needs: [logger-publish] - if: always() runs-on: macos-14 steps: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - # - name: Release generation - # run: ./git-release.sh "${{ github.event.head_commit.message }}" "${{secrets.GITHUBACCESSTOKEN}}" "${{secrets.GITHUBUSER}}" + - name: Release generation + run: ./git-release.sh "${{ github.event.head_commit.message }}" "${{secrets.GITHUBACCESSTOKEN}}" "${{secrets.GITHUBUSER}}" - name: Update bundler run: gem install bundler - name: Install bundler dependencies @@ -80,5 +87,8 @@ jobs: 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 }} diff --git a/git-logger-release-branch-create.sh b/git-logger-release-branch-create.sh index 2edc7177..ee882085 100755 --- a/git-logger-release-branch-create.sh +++ b/git-logger-release-branch-create.sh @@ -12,12 +12,12 @@ if ! [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then exit 1 fi -version=$1 +version="$1-logger" # Add logger- prefix to version # Update version in MindboxLogger.podspec logger_podspec_file="MindboxLogger.podspec" -sed -i '' "s/^\([[:space:]]*spec.version[[:space:]]*=[[:space:]]*'logger-\).*\('\)$/\1$version\2/" "$logger_podspec_file" -echo "$logger_podspec_file version updated to logger-$version." +sed -i '' "s/^\([[:space:]]*spec.version[[:space:]]*=[[:space:]]*'\).*\('\)$/\1$version\2/" "$logger_podspec_file" +echo "$logger_podspec_file version updated to $version." # Update dependency version in Mindbox.podspec podspec_file="Mindbox.podspec" @@ -29,14 +29,14 @@ notification_podspec_file="MindboxNotifications.podspec" sed -i '' "s/\(spec.dependency 'MindboxLogger', '\)[^']*\(\'\)/\1$version\2/g" "$notification_podspec_file" echo "$notification_podspec_file dependency on MindboxLogger updated to $version." - git add $logger_podspec_file $podspec_file $notification_podspec_file git commit -m "Update MindboxLogger and dependencies to version $version" git push origin HEAD echo "Version update completed and pushed to repository." -tag="logger-$version" +tag=$version git tag $tag git push origin $tag echo "Tag $tag pushed to repository." + From ff4a75a47163c4a36deee0da1a88d77042bb100b Mon Sep 17 00:00:00 2001 From: Akylbek Utekeshev Date: Tue, 14 May 2024 14:44:57 +0500 Subject: [PATCH 2/3] MBX-3346 PR comment fix --- .github/workflows/prepare_logger_branch.yml | 2 +- .github/workflows/publish.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prepare_logger_branch.yml b/.github/workflows/prepare_logger_branch.yml index bde531ac..30a45943 100644 --- a/.github/workflows/prepare_logger_branch.yml +++ b/.github/workflows/prepare_logger_branch.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v4 - name: Extract version from branch name - run: echo "VERSION=${GITHUB_REF#refs/heads/test-logger-release/}" >> $GITHUB_ENV + run: echo "VERSION=${GITHUB_REF#refs/heads/logger-release/}" >> $GITHUB_ENV - name: Bump version run: ./git-logger-release-branch-create.sh "${{ env.VERSION }}" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f85d4f0f..96dae627 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,7 +12,7 @@ jobs: unit: runs-on: macos-14 steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + - uses: actions/checkout@v4 - name: Update bundler run: gem install bundler - name: Install bundler dependencies @@ -52,13 +52,13 @@ jobs: channel-id: 'C06RXV161RA' payload: | { - "text": "iOS - MindboxLogger release", + "text": "iOS - release", "blocks": [ { "type": "header", "text": { "type": "plain_text", - "text": "🚀 MindboxLogger tested." + "text": "🚀 MindboxLogger has been successfuly released." } } ] @@ -70,7 +70,7 @@ jobs: needs: [logger-publish] runs-on: macos-14 steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 + - uses: actions/checkout@v4 - name: Release generation run: ./git-release.sh "${{ github.event.head_commit.message }}" "${{secrets.GITHUBACCESSTOKEN}}" "${{secrets.GITHUBUSER}}" - name: Update bundler From 20a8602a449b65ba7352f44bca07566d8fad279f Mon Sep 17 00:00:00 2001 From: Akylbek Utekeshev Date: Fri, 17 May 2024 16:26:15 +0500 Subject: [PATCH 3/3] MBX-0000 Test publish --- .github/workflows/publish.yml | 147 ++++++++++++++++++---------------- MindboxLogger.podspec | 2 +- 2 files changed, 78 insertions(+), 71 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 96dae627..61900dee 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,23 +5,23 @@ on: branches: - 'master' - 'support/*' + - 'feature/MBX-3346-MindboxLoggerCI' tags-ignore: - '**' jobs: - unit: - runs-on: macos-14 - steps: - - uses: actions/checkout@v4 - - name: Update bundler - run: gem install bundler - - name: Install bundler dependencies - run: bundle install - - name: Run unit tests - run: bundle exec fastlane unitTestLane + # unit: + # runs-on: macos-14 + # steps: + # - uses: actions/checkout@v4 + # - name: Update bundler + # run: gem install bundler + # - name: Install bundler dependencies + # run: bundle install + # - name: Run unit tests + # run: bundle exec fastlane unitTestLane logger-publish: - needs: [unit] runs-on: macos-14 steps: - uses: actions/checkout@v4 @@ -29,66 +29,73 @@ jobs: run: gem install bundler - name: Install bundler dependencies run: bundle install - - name: Deploy to Cocoapods + - name: Deploy to Cocoapods MindboxLogger run: | - set -eo pipefail - pod lib lint --allow-warnings - output=$(pod trunk push Mindbox.podspec --allow-warnings 2>&1) - echo "$output" - if echo "$output" | grep -q "Unable to accept duplicate entry for: MindboxLogger"; then - echo "Обнаружен дубликат версии, пропускаем публикацию." - exit 0 - else - echo "Ошибка при публикации, требуется вмешательство." - echo "$output" - exit 1 - fi + pod lib lint MindboxLogger.podspec --allow-warnings + pod trunk push MindboxLogger.podspec --allow-warnings 2>&1 || { + if [ $? -eq 0 ]; then + echo "Pushed to CocoaPods Trunk successfully." + elif pod trunk push MindboxLogger.podspec --allow-warnings 2>&1 | grep -q "[!] Unable to accept duplicate entry for: MindboxLogger (0.0.8)"; then + echo "Duplicate entry found, continuing as if successful." + else + echo "An error occurred." + exit 1 + fi + } + + # output=$(pod trunk push MindboxLogger.podspec --allow-warnings 2>&1) + # echo "$output" + # if echo "$output" | grep -q "Unable to accept duplicate entry for: MindboxLogger"; then + # echo "Обнаружен дубликат версии, пропускаем публикацию." + # exit 0 + # else + # echo "Ошибка при публикации, требуется вмешательство." + # echo "$output" + # exit 1 + # fi env: COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TOKEN }} - - name: Post to a Slack channel - id: slack - uses: slackapi/slack-github-action@v1.26.0 - 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 }} + # - name: Post to a Slack channel + # id: slack + # uses: slackapi/slack-github-action@v1.26.0 + # 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: [logger-publish] - runs-on: macos-14 - steps: - - uses: actions/checkout@v4 - - name: Release generation - run: ./git-release.sh "${{ github.event.head_commit.message }}" "${{secrets.GITHUBACCESSTOKEN}}" "${{secrets.GITHUBUSER}}" - - 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: Run build - run: bundle exec fastlane buildLane - env: - CI: true - - name: Deploy to Cocoapods - 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 }} + # publish: + # needs: [logger-publish] + # runs-on: macos-14 + # steps: + # - uses: actions/checkout@v4 + # - name: Release generation + # run: ./git-release.sh "${{ github.event.head_commit.message }}" "${{secrets.GITHUBACCESSTOKEN}}" "${{secrets.GITHUBUSER}}" + # - 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: Run build + # run: bundle exec fastlane buildLane + # env: + # CI: true + # - name: Deploy to Cocoapods Mindbox/MindboxNotifications + # run: | + # set -eo pipefail + # pod lib lint --allow-warnings + # env: + # COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TOKEN }} diff --git a/MindboxLogger.podspec b/MindboxLogger.podspec index 088e6bca..f0f806f9 100644 --- a/MindboxLogger.podspec +++ b/MindboxLogger.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |spec| spec.license = { :type => "CC BY-NC-ND 4.0", :file => "LICENSE" } spec.author = { "Mindbox" => "ios-sdk@mindbox.ru" } spec.platform = :ios, "10.0" - spec.source = { :git => "https://github.com/mindbox-cloud/ios-sdk.git", :tag => "#{spec.version}-logger" } + spec.source = { :git => "https://github.com/mindbox-cloud/ios-sdk.git", :tag => "#{spec.version}" } spec.source_files = "MindboxLogger/**/*.{swift}", "SDKVersionProvider/**/*.{swift}" spec.exclude_files = "Classes/Exclude" spec.resource_bundles = {