From bf2d9671d129fd8a6912915a7de23aedb683b118 Mon Sep 17 00:00:00 2001 From: sozinov Date: Thu, 10 Apr 2025 13:07:43 +0300 Subject: [PATCH 01/11] bump rn version --- example/exampleApp/android/app/build.gradle | 2 +- example/exampleApp/android/build.gradle | 2 +- example/exampleApp/package.json | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/example/exampleApp/android/app/build.gradle b/example/exampleApp/android/app/build.gradle index 4d55b8b..c9adc89 100644 --- a/example/exampleApp/android/app/build.gradle +++ b/example/exampleApp/android/app/build.gradle @@ -47,7 +47,7 @@ android { dependencies { implementation("com.facebook.react:react-android") - implementation "com.facebook.react:react-native:0.73.3" + implementation "com.facebook.react:react-native:0.74.0" // Integration of Mindbox SDK and necessary Firebase and Huawei services for mobile push notifications functionality implementation platform('com.google.firebase:firebase-bom:29.3.1') diff --git a/example/exampleApp/android/build.gradle b/example/exampleApp/android/build.gradle index 8957584..52f2df7 100644 --- a/example/exampleApp/android/build.gradle +++ b/example/exampleApp/android/build.gradle @@ -1,7 +1,7 @@ buildscript { ext { buildToolsVersion = "34.0.0" - minSdkVersion = 21 + minSdkVersion = 23 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "25.1.8937393" diff --git a/example/exampleApp/package.json b/example/exampleApp/package.json index 729abab..8d6e6b4 100644 --- a/example/exampleApp/package.json +++ b/example/exampleApp/package.json @@ -13,9 +13,9 @@ "@react-navigation/native": "^6.1.6", "@react-navigation/native-stack": "^6.9.17", "@react-navigation/stack": "^6.3.20", - "mindbox-sdk": "^2.13.0", + "mindbox-sdk": "^2.13.1", "react": "18.2.0", - "react-native": "0.73.4", + "react-native": "0.74.0", "react-native-gesture-handler": "^2.21.2", "react-native-permissions": "^5.0.0", "react-native-safe-area-context": "^4.9.0", @@ -26,10 +26,10 @@ "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", - "@react-native/babel-preset": "0.73.20", - "@react-native/eslint-config": "0.73.2", - "@react-native/metro-config": "0.73.4", - "@react-native/typescript-config": "0.73.1", + "@react-native/babel-preset": "0.74.0", + "@react-native/eslint-config": "0.74.0", + "@react-native/metro-config": "0.74.0", + "@react-native/typescript-config": "0.74.0", "@types/react": "^18.2.6", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", From fa5c3fdb3f7855ffc119ecf27fde07f02f3992ff Mon Sep 17 00:00:00 2001 From: sozinov Date: Wed, 14 May 2025 10:25:18 +0300 Subject: [PATCH 02/11] WMSDK-442: change publish workflows --- .github/workflows/distribute.yml | 24 --------- .../{build.yml => lint_and_test.yml} | 0 .github/workflows/pr-description-validate.yml | 6 +-- .github/workflows/publish-manual.yml | 22 ++++++++ .github/workflows/publish-master.yml | 16 ++++++ .../{release.yml => publish-reusable.yml} | 16 ++++-- .github/workflows/release-version-check.yml | 50 +++++++++++++++++++ .../workflows/trigger-build-app-develop.yml | 15 ++++++ .../workflows/trigger-build-app-manual.yml | 11 ++++ .../trigger-build-app-master-support.yml | 19 +++++++ ...app.yml => trigger-build-app-reusable.yml} | 17 ++++--- 11 files changed, 156 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/distribute.yml rename .github/workflows/{build.yml => lint_and_test.yml} (100%) create mode 100644 .github/workflows/publish-manual.yml create mode 100644 .github/workflows/publish-master.yml rename .github/workflows/{release.yml => publish-reusable.yml} (91%) create mode 100644 .github/workflows/release-version-check.yml create mode 100644 .github/workflows/trigger-build-app-develop.yml create mode 100644 .github/workflows/trigger-build-app-manual.yml create mode 100644 .github/workflows/trigger-build-app-master-support.yml rename .github/workflows/{trigger-build-app.yml => trigger-build-app-reusable.yml} (71%) diff --git a/.github/workflows/distribute.yml b/.github/workflows/distribute.yml deleted file mode 100644 index 9ea141a..0000000 --- a/.github/workflows/distribute.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: SDK Distribute - -on: - push: - branches: - - 'release/*' - pull_request: - types: [ closed ] - branches: - - develop - -jobs: - update_on_merge: - #if: github.event.pull_request.merged == true || (github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')) - if: false - runs-on: ubuntu-latest - steps: - - name: trigger build & send to FAD - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: 80115879 - repo: mindbox-cloud/react-native-app - ref: develop - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build.yml b/.github/workflows/lint_and_test.yml similarity index 100% rename from .github/workflows/build.yml rename to .github/workflows/lint_and_test.yml diff --git a/.github/workflows/pr-description-validate.yml b/.github/workflows/pr-description-validate.yml index ee497c9..4f9be80 100644 --- a/.github/workflows/pr-description-validate.yml +++ b/.github/workflows/pr-description-validate.yml @@ -9,11 +9,11 @@ on: jobs: check-description: runs-on: ubuntu-latest - + if: ${{ github.event_name == 'pull_request' || github.event.issue.pull_request }} steps: - name: Check out the repository uses: actions/checkout@v4 - + - name: Check PR description id: validate_description_step uses: actions/github-script@v7 @@ -23,7 +23,7 @@ jobs: const pr = context.payload.pull_request; if (!pr || !pr.body || pr.body.trim().length === 0) { core.setOutput('pr_description_check_passed', 'false'); - } + } else { core.setOutput('pr_description_check_passed', 'true'); } diff --git a/.github/workflows/publish-manual.yml b/.github/workflows/publish-manual.yml new file mode 100644 index 0000000..3337928 --- /dev/null +++ b/.github/workflows/publish-manual.yml @@ -0,0 +1,22 @@ +name: SDK publish manual + +on: + workflow_dispatch: + +jobs: + check-branch: + runs-on: ubuntu-latest + steps: + - name: Check if branch matches pattern + run: | + if ! echo "${{ github.ref_name }}" | grep -q "release/.*-rc"; then + echo "Branch name must match pattern 'release/*-rc' (e.g. release/2.13.2-rc)" + exit 1 + fi + + call-publish-reusable: + needs: check-branch + uses: ./.github/workflows/publish-reusable.yml + with: + branch: ${{ github.ref_name }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/publish-master.yml b/.github/workflows/publish-master.yml new file mode 100644 index 0000000..7bf830c --- /dev/null +++ b/.github/workflows/publish-master.yml @@ -0,0 +1,16 @@ +name: SDK publish RN master and support + +on: + pull_request: + types: [closed] + branches: + - 'master' + - 'support/*' + +jobs: + call-reusable: + if: ${{ github.event.pull_request.merged == true }} + uses: ./.github/workflows/publish-reusable.yml + with: + branch: ${{ github.base_ref }} + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/publish-reusable.yml similarity index 91% rename from .github/workflows/release.yml rename to .github/workflows/publish-reusable.yml index 610f00e..2ca0da2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/publish-reusable.yml @@ -1,15 +1,15 @@ name: Release to NPM on: - pull_request: - types: [closed] - branches: - - master + workflow_call: + inputs: + branch: + required: true + type: string jobs: checkingVersion: name: Checking version - if: github.event.pull_request.merged runs-on: ubuntu-latest outputs: isRunable: ${{ fromJson(steps.package.outputs.content).version != fromJson(steps.package.outputs.content).target-version }} @@ -17,6 +17,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} - name: Read package.json id: package uses: juliangruber/read-file-action@v1 @@ -36,6 +38,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} - name: Setup node JS uses: actions/setup-node@v2 with: @@ -54,6 +58,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} - name: Setup node JS uses: actions/setup-node@v2 with: diff --git a/.github/workflows/release-version-check.yml b/.github/workflows/release-version-check.yml new file mode 100644 index 0000000..ee581d5 --- /dev/null +++ b/.github/workflows/release-version-check.yml @@ -0,0 +1,50 @@ +name: release-version-check + +on: + pull_request: + types: [opened, edited, synchronize] + branches: + - master + - develop + +jobs: + check-rc-pattern: + runs-on: ubuntu-latest + if: startsWith(github.head_ref, 'release') + steps: + - name: Check RC pattern + run: | + if [[ "${{ github.head_ref }}" =~ release/[0-9]+\.[0-9]+\.[0-9]+-rc ]]; then + echo "Branch name contains release/version-rc pattern. Merging is not allowed. Only stable release should be merge into master" + exit 1 + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + check-master-version: + needs: check-rc-pattern + runs-on: ubuntu-latest + if: github.base_ref == 'master' && startsWith(github.head_ref, 'release') + steps: + - name: Checkout master branch + uses: actions/checkout@v4 + with: + ref: master + path: master + - name: Checkout release branch + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + path: release + - name: Extract versions + run: | + MASTER_VERSION=$(grep 'target-version' master/package.json | awk '{print $2}' | tr -d '",') + RELEASE_VERSION=$(grep 'target-version' release/package.json | awk '{print $2}' | tr -d '",') + echo "MASTER_VERSION=$MASTER_VERSION" >> $GITHUB_ENV + echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV + - name: Compare versions + uses: jackbilestech/semver-compare@1.0.4 + with: + head: ${{ env.RELEASE_VERSION }} + base: ${{ env.MASTER_VERSION }} + operator: '>' diff --git a/.github/workflows/trigger-build-app-develop.yml b/.github/workflows/trigger-build-app-develop.yml new file mode 100644 index 0000000..527d8e7 --- /dev/null +++ b/.github/workflows/trigger-build-app-develop.yml @@ -0,0 +1,15 @@ +name: Build application after merge into develop + +on: + pull_request: + types: [closed] + branches: + - 'develop' + +jobs: + call-reusable: + if: ${{ github.event.pull_request.merged == true }} + uses: ./.github/workflows/trigger-build-app-reusable.yml + with: + branch: ${{ github.base_ref }} + secrets: inherit diff --git a/.github/workflows/trigger-build-app-manual.yml b/.github/workflows/trigger-build-app-manual.yml new file mode 100644 index 0000000..5c7ae41 --- /dev/null +++ b/.github/workflows/trigger-build-app-manual.yml @@ -0,0 +1,11 @@ +name: Build application manual + +on: + workflow_dispatch: + +jobs: + call-reusable: + uses: ./.github/workflows/trigger-build-app-reusable.yml + with: + branch: ${{ github.ref_name }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/trigger-build-app-master-support.yml b/.github/workflows/trigger-build-app-master-support.yml new file mode 100644 index 0000000..19e46e8 --- /dev/null +++ b/.github/workflows/trigger-build-app-master-support.yml @@ -0,0 +1,19 @@ +name: Build application when create PR into master/support/mission + +on: + pull_request: + branches: + - master + - support/* + - mission/* + types: + - opened + - synchronize + +jobs: + call-reusable: + if: ${{ startsWith(github.event.pull_request.head.ref, 'release/') }} + uses: ./.github/workflows/trigger-build-app-reusable.yml + with: + branch: ${{ github.event.pull_request.head.ref }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/trigger-build-app.yml b/.github/workflows/trigger-build-app-reusable.yml similarity index 71% rename from .github/workflows/trigger-build-app.yml rename to .github/workflows/trigger-build-app-reusable.yml index 2b1aabd..6ab6bcf 100644 --- a/.github/workflows/trigger-build-app.yml +++ b/.github/workflows/trigger-build-app-reusable.yml @@ -1,19 +1,20 @@ -name: Build application after merge +name: Build pushok on: - pull_request: - types: [closed] - branches: - - 'feature/*' - - 'develop' + workflow_call: + inputs: + branch: + required: true + type: string jobs: trigger: runs-on: macos-latest - if: github.event.pull_request.merged == true steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} - name: Get last 3 commit messages run: | @@ -25,5 +26,5 @@ jobs: curl --location 'https://mindbox.gitlab.yandexcloud.net/api/v4/projects/1512/trigger/pipeline' \ --form 'token="${{ secrets.GITLAB_TRIGGER_TOKEN }}"' \ --form 'ref="develop"' \ - --form "variables[INPUT_BRANCH]=\"${{ github.head_ref }}\"" \ + --form "variables[INPUT_BRANCH]=\"${{ inputs.branch }}\"" \ --form "variables[INPUT_COMMITS]=\"${{ env.commits }}\"" From 1ba795bac8c617b221d438b1a4e26ecbb74a66e2 Mon Sep 17 00:00:00 2001 From: sozinov Date: Wed, 14 May 2025 14:14:14 +0300 Subject: [PATCH 03/11] WMSDK-442: change publish workflows --- .../workflows/gitleaks-secrets-validate.yml | 18 +-- .github/workflows/lint_and_test.yml | 82 +++++------ .github/workflows/pr-description-validate.yml | 4 +- .github/workflows/publish-manual.yml | 2 +- .github/workflows/publish-master.yml | 6 +- .github/workflows/publish-reusable.yml | 136 +++++++++--------- .github/workflows/release-version-check.yml | 66 ++++----- .../workflows/trigger-build-app-develop.yml | 16 +-- .../workflows/trigger-build-app-reusable.yml | 40 +++--- 9 files changed, 185 insertions(+), 185 deletions(-) diff --git a/.github/workflows/gitleaks-secrets-validate.yml b/.github/workflows/gitleaks-secrets-validate.yml index 0ad5ccb..064c728 100644 --- a/.github/workflows/gitleaks-secrets-validate.yml +++ b/.github/workflows/gitleaks-secrets-validate.yml @@ -7,13 +7,13 @@ jobs: name: gitleaks runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Run Gitleaks - uses: gitleaks/gitleaks-action@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITLEAKS_LICENSE: ${{ secrets.MINDBOX_GITLEAKS_LICENSE }} + - name: Run Gitleaks + uses: gitleaks/gitleaks-action@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITLEAKS_LICENSE: ${{ secrets.MINDBOX_GITLEAKS_LICENSE }} diff --git a/.github/workflows/lint_and_test.yml b/.github/workflows/lint_and_test.yml index d489187..8d9ef27 100644 --- a/.github/workflows/lint_and_test.yml +++ b/.github/workflows/lint_and_test.yml @@ -1,46 +1,46 @@ name: RN SDK CI on: - pull_request: - types: [opened, synchronize] - branches: - - develop - paths-ignore: - - '**.md' + pull_request: + types: [ opened, synchronize ] + branches: + - develop + paths-ignore: + - '**.md' jobs: - unit-tests: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup node JS - uses: actions/setup-node@v2 - with: - node-version: 14 - registry-url: https://registry.npmjs.org - - - name: Setup local environment - run: yarn - - - name: Run unit tests - run: yarn test - - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup node JS - uses: actions/setup-node@v2 - with: - node-version: 14 - registry-url: https://registry.npmjs.org - - - name: Setup local environment - run: yarn - - - name: Run linting - run: yarn lint + unit-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup node JS + uses: actions/setup-node@v2 + with: + node-version: 14 + registry-url: https://registry.npmjs.org + + - name: Setup local environment + run: yarn + + - name: Run unit tests + run: yarn test + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup node JS + uses: actions/setup-node@v2 + with: + node-version: 14 + registry-url: https://registry.npmjs.org + + - name: Setup local environment + run: yarn + + - name: Run linting + run: yarn lint diff --git a/.github/workflows/pr-description-validate.yml b/.github/workflows/pr-description-validate.yml index 4f9be80..da05990 100644 --- a/.github/workflows/pr-description-validate.yml +++ b/.github/workflows/pr-description-validate.yml @@ -2,9 +2,9 @@ name: Validate PR description is not empty on: pull_request: - types: [opened, edited, reopened, synchronize] + types: [ opened, edited, reopened, synchronize ] issue_comment: - types: [created] + types: [ created ] jobs: check-description: diff --git a/.github/workflows/publish-manual.yml b/.github/workflows/publish-manual.yml index 3337928..3498cc2 100644 --- a/.github/workflows/publish-manual.yml +++ b/.github/workflows/publish-manual.yml @@ -19,4 +19,4 @@ jobs: uses: ./.github/workflows/publish-reusable.yml with: branch: ${{ github.ref_name }} - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/publish-master.yml b/.github/workflows/publish-master.yml index 7bf830c..16fc17e 100644 --- a/.github/workflows/publish-master.yml +++ b/.github/workflows/publish-master.yml @@ -2,10 +2,10 @@ name: SDK publish RN master and support on: pull_request: - types: [closed] + types: [ closed ] branches: - - 'master' - - 'support/*' + - 'master' + - 'support/*' jobs: call-reusable: diff --git a/.github/workflows/publish-reusable.yml b/.github/workflows/publish-reusable.yml index 2ca0da2..f94adc2 100644 --- a/.github/workflows/publish-reusable.yml +++ b/.github/workflows/publish-reusable.yml @@ -1,11 +1,11 @@ name: Release to NPM on: - workflow_call: - inputs: - branch: - required: true - type: string + workflow_call: + inputs: + branch: + required: true + type: string jobs: checkingVersion: @@ -15,77 +15,77 @@ jobs: isRunable: ${{ fromJson(steps.package.outputs.content).version != fromJson(steps.package.outputs.content).target-version }} newVersion: ${{ fromJson(steps.package.outputs.content).target-version }} steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} - - name: Read package.json - id: package - uses: juliangruber/read-file-action@v1 - with: - path: ./package.json - - name: Version check - if: ${{ fromJson(steps.package.outputs.content).version == fromJson(steps.package.outputs.content).target-version }} - uses: actions/github-script@v6 - with: - script: | - core.setFailed('Packet version and target version are equivalent!') + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} + - name: Read package.json + id: package + uses: juliangruber/read-file-action@v1 + with: + path: ./package.json + - name: Version check + if: ${{ fromJson(steps.package.outputs.content).version == fromJson(steps.package.outputs.content).target-version }} + uses: actions/github-script@v6 + with: + script: | + core.setFailed('Packet version and target version are equivalent!') testing: name: Testing - needs: [checkingVersion] + needs: [ checkingVersion ] if: needs.checkingVersion.outputs.isRunable == 'true' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} - - name: Setup node JS - uses: actions/setup-node@v2 - with: - node-version: 14 - registry-url: https://registry.npmjs.org - - name: Setup local environment - run: yarn - - name: Run tests - run: yarn test + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} + - name: Setup node JS + uses: actions/setup-node@v2 + with: + node-version: 14 + registry-url: https://registry.npmjs.org + - name: Setup local environment + run: yarn + - name: Run tests + run: yarn test releasing: name: Releasing - needs: [checkingVersion, testing] + needs: [ checkingVersion, testing ] if: needs.checkingVersion.outputs.isRunable == 'true' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} - - name: Setup node JS - uses: actions/setup-node@v2 - with: - node-version: 14 - registry-url: https://registry.npmjs.org - - name: Setup GIT - run: | - git config user.email '$GITHUB_ACTOR@users.noreply.github.com' - git config user.name '$GITHUB_ACTOR' - - name: Setup local environment - run: yarn - - name: Determine Pre-Release Status - run: | - VERSION=${{ needs.checkingVersion.outputs.newVersion }} - if [[ "$VERSION" == *"rc"* ]]; then - echo "::set-output name=is_prerelease::true" - else - echo "::set-output name=is_prerelease::false" - fi - - name: Release - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_CICD_SECRET }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [ ${{ steps.prerelease_check.outputs.is_prerelease }} == "true" ]; then - yarn release ${{ needs.checkingVersion.outputs.newVersion }} --pre-release --no-plugins.@release-it/keep-a-changelog.strictLatest --ci - else - yarn release ${{ needs.checkingVersion.outputs.newVersion }} --no-plugins.@release-it/keep-a-changelog.strictLatest --ci - fi + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} + - name: Setup node JS + uses: actions/setup-node@v2 + with: + node-version: 14 + registry-url: https://registry.npmjs.org + - name: Setup GIT + run: | + git config user.email '$GITHUB_ACTOR@users.noreply.github.com' + git config user.name '$GITHUB_ACTOR' + - name: Setup local environment + run: yarn + - name: Determine Pre-Release Status + run: | + VERSION=${{ needs.checkingVersion.outputs.newVersion }} + if [[ "$VERSION" == *"rc"* ]]; then + echo "::set-output name=is_prerelease::true" + else + echo "::set-output name=is_prerelease::false" + fi + - name: Release + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_CICD_SECRET }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ ${{ steps.prerelease_check.outputs.is_prerelease }} == "true" ]; then + yarn release ${{ needs.checkingVersion.outputs.newVersion }} --pre-release --no-plugins.@release-it/keep-a-changelog.strictLatest --ci + else + yarn release ${{ needs.checkingVersion.outputs.newVersion }} --no-plugins.@release-it/keep-a-changelog.strictLatest --ci + fi diff --git a/.github/workflows/release-version-check.yml b/.github/workflows/release-version-check.yml index ee581d5..2dbe862 100644 --- a/.github/workflows/release-version-check.yml +++ b/.github/workflows/release-version-check.yml @@ -2,49 +2,49 @@ name: release-version-check on: pull_request: - types: [opened, edited, synchronize] + types: [ opened, edited, synchronize ] branches: - - master - - develop + - master + - develop jobs: check-rc-pattern: runs-on: ubuntu-latest if: startsWith(github.head_ref, 'release') steps: - - name: Check RC pattern - run: | - if [[ "${{ github.head_ref }}" =~ release/[0-9]+\.[0-9]+\.[0-9]+-rc ]]; then - echo "Branch name contains release/version-rc pattern. Merging is not allowed. Only stable release should be merge into master" - exit 1 - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Check RC pattern + run: | + if [[ "${{ github.head_ref }}" =~ release/[0-9]+\.[0-9]+\.[0-9]+-rc ]]; then + echo "Branch name contains release/version-rc pattern. Merging is not allowed. Only stable release should be merge into master" + exit 1 + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} check-master-version: needs: check-rc-pattern runs-on: ubuntu-latest if: github.base_ref == 'master' && startsWith(github.head_ref, 'release') steps: - - name: Checkout master branch - uses: actions/checkout@v4 - with: - ref: master - path: master - - name: Checkout release branch - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - path: release - - name: Extract versions - run: | - MASTER_VERSION=$(grep 'target-version' master/package.json | awk '{print $2}' | tr -d '",') - RELEASE_VERSION=$(grep 'target-version' release/package.json | awk '{print $2}' | tr -d '",') - echo "MASTER_VERSION=$MASTER_VERSION" >> $GITHUB_ENV - echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV - - name: Compare versions - uses: jackbilestech/semver-compare@1.0.4 - with: - head: ${{ env.RELEASE_VERSION }} - base: ${{ env.MASTER_VERSION }} - operator: '>' + - name: Checkout master branch + uses: actions/checkout@v4 + with: + ref: master + path: master + - name: Checkout release branch + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + path: release + - name: Extract versions + run: | + MASTER_VERSION=$(grep 'target-version' master/package.json | awk '{print $2}' | tr -d '",') + RELEASE_VERSION=$(grep 'target-version' release/package.json | awk '{print $2}' | tr -d '",') + echo "MASTER_VERSION=$MASTER_VERSION" >> $GITHUB_ENV + echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV + - name: Compare versions + uses: jackbilestech/semver-compare@1.0.4 + with: + head: ${{ env.RELEASE_VERSION }} + base: ${{ env.MASTER_VERSION }} + operator: '>' diff --git a/.github/workflows/trigger-build-app-develop.yml b/.github/workflows/trigger-build-app-develop.yml index 527d8e7..3e1b803 100644 --- a/.github/workflows/trigger-build-app-develop.yml +++ b/.github/workflows/trigger-build-app-develop.yml @@ -2,14 +2,14 @@ name: Build application after merge into develop on: pull_request: - types: [closed] + types: [ closed ] branches: - - 'develop' + - 'develop' jobs: - call-reusable: - if: ${{ github.event.pull_request.merged == true }} - uses: ./.github/workflows/trigger-build-app-reusable.yml - with: - branch: ${{ github.base_ref }} - secrets: inherit + call-reusable: + if: ${{ github.event.pull_request.merged == true }} + uses: ./.github/workflows/trigger-build-app-reusable.yml + with: + branch: ${{ github.base_ref }} + secrets: inherit diff --git a/.github/workflows/trigger-build-app-reusable.yml b/.github/workflows/trigger-build-app-reusable.yml index 6ab6bcf..8ed968f 100644 --- a/.github/workflows/trigger-build-app-reusable.yml +++ b/.github/workflows/trigger-build-app-reusable.yml @@ -1,30 +1,30 @@ name: Build pushok on: - workflow_call: - inputs: - branch: - required: true - type: string + workflow_call: + inputs: + branch: + required: true + type: string jobs: trigger: runs-on: macos-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ inputs.branch }} - - name: Get last 3 commit messages - run: | - commits=$(git log -3 --pretty=format:"%s") - echo "commits=$commits" >> $GITHUB_ENV + - name: Get last 3 commit messages + run: | + commits=$(git log -3 --pretty=format:"%s") + echo "commits=$commits" >> $GITHUB_ENV - - name: Trigger build workflow in react-native-app repo - run: | - curl --location 'https://mindbox.gitlab.yandexcloud.net/api/v4/projects/1512/trigger/pipeline' \ - --form 'token="${{ secrets.GITLAB_TRIGGER_TOKEN }}"' \ - --form 'ref="develop"' \ - --form "variables[INPUT_BRANCH]=\"${{ inputs.branch }}\"" \ - --form "variables[INPUT_COMMITS]=\"${{ env.commits }}\"" + - name: Trigger build workflow in react-native-app repo + run: | + curl --location 'https://mindbox.gitlab.yandexcloud.net/api/v4/projects/1512/trigger/pipeline' \ + --form 'token="${{ secrets.GITLAB_TRIGGER_TOKEN }}"' \ + --form 'ref="develop"' \ + --form "variables[INPUT_BRANCH]=\"${{ inputs.branch }}\"" \ + --form "variables[INPUT_COMMITS]=\"${{ env.commits }}\"" From 8bf23c1ead2b87000ab5d2159975c096419adc93 Mon Sep 17 00:00:00 2001 From: sozinov Date: Wed, 14 May 2025 16:19:21 +0300 Subject: [PATCH 04/11] WMSDK-442: update git-release-branch.sh --- git-release-branch.sh | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/git-release-branch.sh b/git-release-branch.sh index ac20e58..acf3a13 100755 --- a/git-release-branch.sh +++ b/git-release-branch.sh @@ -33,6 +33,27 @@ sed -i '' "s/\"target-version\": \".*\"/\"target-version\": \"$version\"/" $pack echo "Bump SDK version from $current_version to $version." git add $package_json -git commit -m "Bump SDK version to $version" --no-verify + +android_gradle="android/build.gradle" +ios_podspec="MindboxSdk.podspec" + +sed -i '' "s/ api 'cloud.mindbox:mobile-sdk:.*/ api 'cloud.mindbox:mobile-sdk:${version}'/" "$android_gradle" +echo "Bump $android_gradle to $version" + +sed -i '' "s/ s.dependency \"Mindbox\", .*/ s.dependency \"Mindbox\", \"${version}\"/" "$ios_podspec" +sed -i '' "s/ s.dependency \"MindboxNotifications\", .*/ s.dependency \"MindboxNotifications\", \"${version}\"/" "$ios_podspec" +echo "Bump $ios_podspec to $version" + +git add "$android_gradle" "$ios_podspec" + +changelog="CHANGELOG.md" + +awk -v ver="$version" 'NR==3{print "## [Unreleased]\n\n ### Changes\n - Upgrade Android SDK dependency to v"ver"\n - Upgrade iOS SDK dependency to v"ver"\n"}1' "$changelog" > "${changelog}.tmp" && mv "${changelog}.tmp" "$changelog" + +echo "Insert Unreleased section to $changelog" + +git add "$changelog" echo "Branch $branch_name has been created." + +git commit -m "Bump SDK version to $version" --no-verify From 6586279134520d9018c01bd3d09d7c6eff5347af Mon Sep 17 00:00:00 2001 From: sozinov Date: Wed, 14 May 2025 18:21:20 +0300 Subject: [PATCH 05/11] WMSDK-442: update git-release-branch.sh --- git-release-branch.sh | 51 +++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/git-release-branch.sh b/git-release-branch.sh index acf3a13..3e0f731 100755 --- a/git-release-branch.sh +++ b/git-release-branch.sh @@ -1,31 +1,28 @@ #!/bin/bash -# Check if the parameter is provided -if [ $# -eq 0 ]; then - echo "Please provide the release version number as a parameter." +current_branch=$(git symbolic-ref --short HEAD) + +if [[ $current_branch != "develop" && ! $current_branch =~ ^release/[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then + echo "The current Git branch ($current_branch) is not 'develop' or in the format 'release/X.Y.Z' or 'release/X.Y.Z-rc'." exit 1 fi +# Check if the parameter is provided +read -p "React native release version: " version + # Check if the version number matches the semver format -if ! [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then +if ! [[ $version =~ ^[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 -current_branch=$(git symbolic-ref --short HEAD) - -if [[ $current_branch != "develop" && ! $current_branch =~ ^release/[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then - echo "The current Git branch ($current_branch) is not 'develop' or in the format 'release/X.Y.Z' or 'release/X.Y.Z-rc'." - exit 1 -fi -# Create a branch with the version name -version=$1 branch_name="release/$version" git branch $branch_name git checkout $branch_name +echo "Branch $branch_name has been created." + package_json="package.json" current_version=$(grep -Eo '"target-version": "[^"]+"' $package_json | cut -d '"' -f 4) sed -i '' "s/\"target-version\": \".*\"/\"target-version\": \"$version\"/" $package_json @@ -37,18 +34,34 @@ git add $package_json android_gradle="android/build.gradle" ios_podspec="MindboxSdk.podspec" -sed -i '' "s/ api 'cloud.mindbox:mobile-sdk:.*/ api 'cloud.mindbox:mobile-sdk:${version}'/" "$android_gradle" -echo "Bump $android_gradle to $version" +read -p "Android SDK version: " android_sdk_version + +# Check if the version number matches the semver format +if ! [[ $android_sdk_version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then + echo "The Android SDK version number does not match the semver format (X.Y.Z or X.Y.Z-rc)." + exit 1 +fi + +sed -i '' "s/ api 'cloud.mindbox:mobile-sdk:.*/ api 'cloud.mindbox:mobile-sdk:${android_sdk_version}'/" "$android_gradle" +echo "Bump $android_gradle to $android_sdk_version" + +read -p "iOS SDK version: " ios_sdk_version + +# Check if the version number matches the semver format +if ! [[ $ios_sdk_version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then + echo "The iOS SDK version number does not match the semver format (X.Y.Z or X.Y.Z-rc)." + exit 1 +fi -sed -i '' "s/ s.dependency \"Mindbox\", .*/ s.dependency \"Mindbox\", \"${version}\"/" "$ios_podspec" -sed -i '' "s/ s.dependency \"MindboxNotifications\", .*/ s.dependency \"MindboxNotifications\", \"${version}\"/" "$ios_podspec" -echo "Bump $ios_podspec to $version" +sed -i '' "s/ s.dependency \"Mindbox\", .*/ s.dependency \"Mindbox\", \"${ios_sdk_version}\"/" "$ios_podspec" +sed -i '' "s/ s.dependency \"MindboxNotifications\", .*/ s.dependency \"MindboxNotifications\", \"${ios_sdk_version}\"/" "$ios_podspec" +echo "Bump $ios_podspec to $ios_sdk_version" git add "$android_gradle" "$ios_podspec" changelog="CHANGELOG.md" -awk -v ver="$version" 'NR==3{print "## [Unreleased]\n\n ### Changes\n - Upgrade Android SDK dependency to v"ver"\n - Upgrade iOS SDK dependency to v"ver"\n"}1' "$changelog" > "${changelog}.tmp" && mv "${changelog}.tmp" "$changelog" +awk -v android="$android_sdk_version" -v ios="$ios_sdk_version" 'NR==3{print "## [Unreleased]\n\n ### Changes\n - Upgrade Android SDK dependency to v"android"\n - Upgrade iOS SDK dependency to v"ios"\n"}1' "$changelog" > "${changelog}.tmp" && mv "${changelog}.tmp" "$changelog" echo "Insert Unreleased section to $changelog" From 7f677c29341eea6de281e30760ea5e41805403d8 Mon Sep 17 00:00:00 2001 From: sozinov Date: Thu, 15 May 2025 14:25:25 +0300 Subject: [PATCH 06/11] WMSDK-442: update workflows --- .github/workflows/publish-master.yml | 2 +- .github/workflows/publish-reusable.yml | 24 ++++++++++++++++++- .../workflows/trigger-build-app-develop.yml | 2 +- .../workflows/trigger-build-app-manual.yml | 4 ++-- .../trigger-build-app-master-support.yml | 4 ++-- .../workflows/trigger-build-app-reusable.yml | 2 +- 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-master.yml b/.github/workflows/publish-master.yml index 16fc17e..91e6326 100644 --- a/.github/workflows/publish-master.yml +++ b/.github/workflows/publish-master.yml @@ -1,4 +1,4 @@ -name: SDK publish RN master and support +name: SDK publish from master or support branch on: pull_request: diff --git a/.github/workflows/publish-reusable.yml b/.github/workflows/publish-reusable.yml index f94adc2..75922c3 100644 --- a/.github/workflows/publish-reusable.yml +++ b/.github/workflows/publish-reusable.yml @@ -1,4 +1,4 @@ -name: Release to NPM +name: SDK publish on: workflow_call: @@ -89,3 +89,25 @@ jobs: else yarn release ${{ needs.checkingVersion.outputs.newVersion }} --no-plugins.@release-it/keep-a-changelog.strictLatest --ci fi + + merge: + needs: [ releasing ] + if: | + startsWith(github.head_ref, 'release') && + github.base_ref == 'master' + 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.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} + - 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 --auto + env: + GITHUB_TOKEN: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} diff --git a/.github/workflows/trigger-build-app-develop.yml b/.github/workflows/trigger-build-app-develop.yml index 3e1b803..a6a42ee 100644 --- a/.github/workflows/trigger-build-app-develop.yml +++ b/.github/workflows/trigger-build-app-develop.yml @@ -1,4 +1,4 @@ -name: Build application after merge into develop +name: Distribute PushOk (Develop PR Merge) on: pull_request: diff --git a/.github/workflows/trigger-build-app-manual.yml b/.github/workflows/trigger-build-app-manual.yml index 5c7ae41..b3cd1fc 100644 --- a/.github/workflows/trigger-build-app-manual.yml +++ b/.github/workflows/trigger-build-app-manual.yml @@ -1,4 +1,4 @@ -name: Build application manual +name: Distribute PushOk (manual) on: workflow_dispatch: @@ -8,4 +8,4 @@ jobs: uses: ./.github/workflows/trigger-build-app-reusable.yml with: branch: ${{ github.ref_name }} - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/trigger-build-app-master-support.yml b/.github/workflows/trigger-build-app-master-support.yml index 19e46e8..3061184 100644 --- a/.github/workflows/trigger-build-app-master-support.yml +++ b/.github/workflows/trigger-build-app-master-support.yml @@ -1,4 +1,4 @@ -name: Build application when create PR into master/support/mission +name: Distribute PushOk (Release / Support PR / Mission) on: pull_request: @@ -16,4 +16,4 @@ jobs: uses: ./.github/workflows/trigger-build-app-reusable.yml with: branch: ${{ github.event.pull_request.head.ref }} - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/trigger-build-app-reusable.yml b/.github/workflows/trigger-build-app-reusable.yml index 8ed968f..271c199 100644 --- a/.github/workflows/trigger-build-app-reusable.yml +++ b/.github/workflows/trigger-build-app-reusable.yml @@ -1,4 +1,4 @@ -name: Build pushok +name: Distribute PushOk (Reusable) on: workflow_call: From 54db50c5820eb9ef7a156f0e5d3bf28b7124db02 Mon Sep 17 00:00:00 2001 From: Sergei Semko <28645140+justSmK@users.noreply.github.com> Date: Fri, 23 May 2025 15:20:56 +0300 Subject: [PATCH 07/11] WMSDK-450: Publish and branch protection update --- ...ublish-master.yml => publish-from-master-or-support.yml} | 2 +- .github/workflows/publish-manual.yml | 2 +- .github/workflows/publish-reusable.yml | 6 ++---- .github/workflows/release-version-check.yml | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) rename .github/workflows/{publish-master.yml => publish-from-master-or-support.yml} (93%) diff --git a/.github/workflows/publish-master.yml b/.github/workflows/publish-from-master-or-support.yml similarity index 93% rename from .github/workflows/publish-master.yml rename to .github/workflows/publish-from-master-or-support.yml index 91e6326..9f75a8f 100644 --- a/.github/workflows/publish-master.yml +++ b/.github/workflows/publish-from-master-or-support.yml @@ -2,7 +2,7 @@ name: SDK publish from master or support branch on: pull_request: - types: [ closed ] + types: [closed] branches: - 'master' - 'support/*' diff --git a/.github/workflows/publish-manual.yml b/.github/workflows/publish-manual.yml index 3498cc2..c4f2669 100644 --- a/.github/workflows/publish-manual.yml +++ b/.github/workflows/publish-manual.yml @@ -1,4 +1,4 @@ -name: SDK publish manual +name: SDK publish RC manual on: workflow_dispatch: diff --git a/.github/workflows/publish-reusable.yml b/.github/workflows/publish-reusable.yml index 75922c3..37efa1a 100644 --- a/.github/workflows/publish-reusable.yml +++ b/.github/workflows/publish-reusable.yml @@ -96,6 +96,8 @@ jobs: startsWith(github.head_ref, 'release') && github.base_ref == 'master' runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} steps: - name: Checkout develop branch uses: actions/checkout@v4 @@ -103,11 +105,7 @@ jobs: 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.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} - 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 --auto - env: - GITHUB_TOKEN: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} diff --git a/.github/workflows/release-version-check.yml b/.github/workflows/release-version-check.yml index 2dbe862..fbdd6c5 100644 --- a/.github/workflows/release-version-check.yml +++ b/.github/workflows/release-version-check.yml @@ -1,4 +1,4 @@ -name: release-version-check +name: Branch Protection on: pull_request: From 1fdff83b60306af677fb18dfbf36ccd98275d94d Mon Sep 17 00:00:00 2001 From: Sergei Semko <28645140+justSmK@users.noreply.github.com> Date: Fri, 23 May 2025 15:22:20 +0300 Subject: [PATCH 08/11] WMSDK-450: Update PushOk distribution --- .../{trigger-build-app-develop.yml => distribute-develop.yml} | 4 ++-- .../{trigger-build-app-manual.yml => distribute-manual.yml} | 2 +- ...ter-support.yml => distribute-release-support-mission.yml} | 4 ++-- ...trigger-build-app-reusable.yml => distribute-reusable.yml} | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename .github/workflows/{trigger-build-app-develop.yml => distribute-develop.yml} (68%) rename .github/workflows/{trigger-build-app-manual.yml => distribute-manual.yml} (71%) rename .github/workflows/{trigger-build-app-master-support.yml => distribute-release-support-mission.yml} (72%) rename .github/workflows/{trigger-build-app-reusable.yml => distribute-reusable.yml} (95%) diff --git a/.github/workflows/trigger-build-app-develop.yml b/.github/workflows/distribute-develop.yml similarity index 68% rename from .github/workflows/trigger-build-app-develop.yml rename to .github/workflows/distribute-develop.yml index a6a42ee..c2e34ed 100644 --- a/.github/workflows/trigger-build-app-develop.yml +++ b/.github/workflows/distribute-develop.yml @@ -1,4 +1,4 @@ -name: Distribute PushOk (Develop PR Merge) +name: PushOk (Develop PR Merge) on: pull_request: @@ -9,7 +9,7 @@ on: jobs: call-reusable: if: ${{ github.event.pull_request.merged == true }} - uses: ./.github/workflows/trigger-build-app-reusable.yml + uses: ./.github/workflows/distribute-reusable.yml with: branch: ${{ github.base_ref }} secrets: inherit diff --git a/.github/workflows/trigger-build-app-manual.yml b/.github/workflows/distribute-manual.yml similarity index 71% rename from .github/workflows/trigger-build-app-manual.yml rename to .github/workflows/distribute-manual.yml index b3cd1fc..8c21bc7 100644 --- a/.github/workflows/trigger-build-app-manual.yml +++ b/.github/workflows/distribute-manual.yml @@ -5,7 +5,7 @@ on: jobs: call-reusable: - uses: ./.github/workflows/trigger-build-app-reusable.yml + uses: ./.github/workflows/distribute-reusable.yml with: branch: ${{ github.ref_name }} secrets: inherit diff --git a/.github/workflows/trigger-build-app-master-support.yml b/.github/workflows/distribute-release-support-mission.yml similarity index 72% rename from .github/workflows/trigger-build-app-master-support.yml rename to .github/workflows/distribute-release-support-mission.yml index 3061184..06ffa4c 100644 --- a/.github/workflows/trigger-build-app-master-support.yml +++ b/.github/workflows/distribute-release-support-mission.yml @@ -1,4 +1,4 @@ -name: Distribute PushOk (Release / Support PR / Mission) +name: Distribute PushOk (Release / Support / Mission PRs) on: pull_request: @@ -13,7 +13,7 @@ on: jobs: call-reusable: if: ${{ startsWith(github.event.pull_request.head.ref, 'release/') }} - uses: ./.github/workflows/trigger-build-app-reusable.yml + uses: ./.github/workflows/distribute-reusable.yml with: branch: ${{ github.event.pull_request.head.ref }} secrets: inherit diff --git a/.github/workflows/trigger-build-app-reusable.yml b/.github/workflows/distribute-reusable.yml similarity index 95% rename from .github/workflows/trigger-build-app-reusable.yml rename to .github/workflows/distribute-reusable.yml index 271c199..f366954 100644 --- a/.github/workflows/trigger-build-app-reusable.yml +++ b/.github/workflows/distribute-reusable.yml @@ -1,4 +1,4 @@ -name: Distribute PushOk (Reusable) +name: Distribute PushOk - Reusable on: workflow_call: From 8df0f73759a1203e49988783dd080c7b79205d80 Mon Sep 17 00:00:00 2001 From: Sergei Semko <28645140+justSmK@users.noreply.github.com> Date: Fri, 23 May 2025 15:25:08 +0300 Subject: [PATCH 09/11] WMSDK-450: Manual branch preparation --- .../manual-prepare_release_branch.yml | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 .github/workflows/manual-prepare_release_branch.yml diff --git a/.github/workflows/manual-prepare_release_branch.yml b/.github/workflows/manual-prepare_release_branch.yml new file mode 100644 index 0000000..7ad4a18 --- /dev/null +++ b/.github/workflows/manual-prepare_release_branch.yml @@ -0,0 +1,192 @@ +name: "Manual Release Prep: React Native" + +on: + workflow_dispatch: + inputs: + release_version: + description: 'React Native release version (semver: X.Y.Z or X.Y.Z-rc)' + required: true + android_sdk_version: + description: 'Native Android SDK version (optional, defaults to RN version)' + required: false + default: '' + ios_sdk_version: + description: 'Native iOS SDK version (optional, defaults to RN version)' + required: false + default: '' + source_branch: + description: 'Create branch from' + required: true + default: 'develop' + target_branch: + description: 'Pull Request to' + required: true + default: 'master' + +jobs: + validate-input: + name: Validate versions format + runs-on: ubuntu-latest + steps: + - name: Check release_version + run: | + V=${{ github.event.inputs.release_version }} + echo "Input release_version=$V" + if ! [[ "$V" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then + echo "❌ release_version must be X.Y.Z or X.Y.Z-rc" + exit 1 + fi + - name: Check android_sdk_version if set + if: ${{ github.event.inputs.android_sdk_version != '' }} + run: | + A=${{ github.event.inputs.android_sdk_version }} + echo "Input android_sdk_version=$A" + if ! [[ "$A" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then + echo "❌ android_sdk_version must be X.Y.Z or X.Y.Z-rc" + exit 1 + fi + - name: Check ios_sdk_version if set + if: ${{ github.event.inputs.ios_sdk_version != '' }} + run: | + I=${{ github.event.inputs.ios_sdk_version }} + echo "Input ios_sdk_version=$I" + if ! [[ "$I" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc)?$ ]]; then + echo "❌ ios_sdk_version must be X.Y.Z or X.Y.Z-rc" + exit 1 + fi + + validate-branches: + name: Validate source & target branches exist + runs-on: ubuntu-latest + needs: validate-input + steps: + - uses: actions/checkout@v4 + with: { fetch-depth: 0 } + - name: Check source branch + run: | + SRC=${{ github.event.inputs.source_branch }} + if ! git ls-remote --heads origin "$SRC" | grep -q "$SRC"; then + echo "❌ source_branch '$SRC' does not exist on origin" + exit 1 + fi + - name: Check target branch + run: | + DST=${{ github.event.inputs.target_branch }} + if ! git ls-remote --heads origin "$DST" | grep -q "$DST"; then + echo "❌ target_branch '$DST' does not exist on origin" + exit 1 + fi + + bump_and_branch: + name: Create release branch & bump versions + runs-on: ubuntu-latest + needs: validate-branches + outputs: + release_branch: ${{ steps.bump.outputs.release_branch }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.source_branch }} + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - id: bump + name: Create branch & apply bumps + run: | + set -euo pipefail + VERSION="${{ github.event.inputs.release_version }}" + AND_VER="${{ github.event.inputs.android_sdk_version }}" + IO_VER="${{ github.event.inputs.ios_sdk_version }}" + SRC="${{ github.event.inputs.source_branch }}" + REL="release/$VERSION" + + # fallback to RN version + [ -z "$AND_VER" ] && AND_VER="$VERSION" + [ -z "$IO_VER" ] && IO_VER="$VERSION" + + echo "→ Branching from $SRC into $REL" + git checkout -b "$REL" + + ############################################################################## + # 1) package.json: bump "target-version" + ############################################################################## + echo "→ Bumping package.json target-version" + sed -i "s/\"target-version\": \".*\"/\"target-version\": \"$VERSION\"/" package.json + git add package.json + + ############################################################################## + # 2) Android build.gradle: bump cloud.mindbox:mobile-sdk: + ############################################################################## + echo "→ Bumping Android SDK in android/build.gradle" + sed -i "s|\(api 'cloud.mindbox:mobile-sdk:\).*|\1$AND_VER'|" android/build.gradle + git add android/build.gradle + + ############################################################################## + # 3) iOS podspec: bump Mindbox and MindboxNotifications dependencies + ############################################################################## + echo "→ Bumping iOS SDK in MindboxSdk.podspec" + sed -i -E "s/(s\.dependency \"Mindbox\", \").*(\")/\1$IO_VER\2/" MindboxSdk.podspec + sed -i -E "s/(s\.dependency \"MindboxNotifications\", \").*(\")/\1$IO_VER\2/" MindboxSdk.podspec + git add MindboxSdk.podspec + + ############################################################################## + # 4) CHANGELOG.md: insert Unreleased section at top + ############################################################################## + echo "→ Inserting Unreleased section into CHANGELOG.md" + awk -v a="$AND_VER" -v i="$IO_VER" ' + /^# Changelog/ { + print + print "" + print "## [Unreleased]" + print "" + print "### Changes" + print "- Upgrade Android SDK dependency to v" a + print "- Upgrade iOS SDK dependency to v" i + print "" + next + } + { print } + ' CHANGELOG.md > CHANGELOG.tmp && mv CHANGELOG.tmp CHANGELOG.md + git add CHANGELOG.md + + ############################################################################## + # 5) Final commit + ############################################################################## + git commit -m "Bump RN SDK versions: core=$VERSION, android=$AND_VER, ios=$IO_VER" + echo "release_branch=$REL" >> $GITHUB_OUTPUT + + - name: Push release branch + run: git push --set-upstream origin ${{ steps.bump.outputs.release_branch }} + + create_pull_request: + name: Create Pull Request + runs-on: ubuntu-latest + needs: bump_and_branch + steps: + - name: Build PR body and open PR + env: + GITHUB_TOKEN: ${{ secrets.PAT_FOR_TRIGGERING_BRANCH_PROTECTION }} + SRC: ${{ needs.bump_and_branch.outputs.release_branch }} + DST: ${{ github.event.inputs.target_branch }} + REPO: ${{ github.repository }} + run: | + AND_VER=${{ github.event.inputs.android_sdk_version }} + IO_VER=${{ github.event.inputs.ios_sdk_version }} + [ -z "$AND_VER" ] && AND_VER="${{ github.event.inputs.release_version }}" + [ -z "$IO_VER" ] && IO_VER="${{ github.event.inputs.release_version }}" + + BODY=$( + printf 'Automated PR: merge `%s` into `%s`\n\n**Versions:**\n- React Native SDK: `%s`\n- Android SDK: `%s`\n- iOS SDK: `%s`' \ + "$SRC" "$DST" "${{ github.event.inputs.release_version }}" "$AND_VER" "$IO_VER" + ) + + gh pr create \ + --repo "$REPO" \ + --base "$DST" \ + --head "$SRC" \ + --title "Release ${{ github.event.inputs.release_version }}" \ + --body "$BODY" From 2e1bbd0343f7730937dd66eaf70b9b1234b5a335 Mon Sep 17 00:00:00 2001 From: Sergei Semko <28645140+justSmK@users.noreply.github.com> Date: Mon, 26 May 2025 12:08:41 +0300 Subject: [PATCH 10/11] Merge pull request #105 from mindbox-cloud/fix/WMSDK-450 WMSDK-450: Fix distribution and tests --- ...develop.yml => distribute-develop-mission.yml} | 8 +++++--- .github/workflows/lint_and_test.yml | 15 +++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) rename .github/workflows/{distribute-develop.yml => distribute-develop-mission.yml} (67%) diff --git a/.github/workflows/distribute-develop.yml b/.github/workflows/distribute-develop-mission.yml similarity index 67% rename from .github/workflows/distribute-develop.yml rename to .github/workflows/distribute-develop-mission.yml index c2e34ed..ad456db 100644 --- a/.github/workflows/distribute-develop.yml +++ b/.github/workflows/distribute-develop-mission.yml @@ -1,10 +1,12 @@ -name: PushOk (Develop PR Merge) +name: Distribute PushOk (Develop / Mission PR Merge) on: pull_request: - types: [ closed ] branches: - - 'develop' + - develop + - mission/* + types: + - closed jobs: call-reusable: diff --git a/.github/workflows/lint_and_test.yml b/.github/workflows/lint_and_test.yml index 8d9ef27..3af9449 100644 --- a/.github/workflows/lint_and_test.yml +++ b/.github/workflows/lint_and_test.yml @@ -1,12 +1,15 @@ -name: RN SDK CI +name: UnitTests + Lint on: - pull_request: - types: [ opened, synchronize ] + push: branches: - - develop - paths-ignore: - - '**.md' + - develop + - mission/* + pull_request: + types: + - opened + - reopened + - synchronize jobs: unit-tests: From 9c2bf43405b5c425569f60579a2dc4efec54abc1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 13:24:12 +0000 Subject: [PATCH 11/11] Bump RN SDK versions: core=2.13.4, android=2.13.4, ios=2.13.4 --- CHANGELOG.md | 7 +++++++ MindboxSdk.podspec | 4 ++-- android/build.gradle | 2 +- package.json | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b64da29..18e7631 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [Unreleased] + +### Changes +- Upgrade Android SDK dependency to v2.13.4 +- Upgrade iOS SDK dependency to v2.13.4 + + ## [2.13.1] - 2025-04-03 ### Changes diff --git a/MindboxSdk.podspec b/MindboxSdk.podspec index 098b382..6a07a7b 100644 --- a/MindboxSdk.podspec +++ b/MindboxSdk.podspec @@ -17,6 +17,6 @@ Pod::Spec.new do |s| s.dependency "React-Core" - s.dependency "Mindbox", "2.13.1" - s.dependency "MindboxNotifications", "2.13.1" + s.dependency "Mindbox", "2.13.4" + s.dependency "MindboxNotifications", "2.13.4" end diff --git a/android/build.gradle b/android/build.gradle index eac2048..6930a00 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -126,5 +126,5 @@ dependencies { // noinspection GradleDynamicVersion api 'com.facebook.react:react-native:+' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - api 'cloud.mindbox:mobile-sdk:2.13.0' + api 'cloud.mindbox:mobile-sdk:2.13.4' } diff --git a/package.json b/package.json index 79036fa..98dbb52 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mindbox-sdk", "version": "2.13.1", - "target-version": "2.13.1", + "target-version": "2.13.4", "description": "SDK for integration React Native mobile apps with Mindbox", "main": "lib/commonjs/index", "module": "lib/module/index",