diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index d489187..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: RN SDK CI - -on: - 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 diff --git a/.github/workflows/distribute-develop-mission.yml b/.github/workflows/distribute-develop-mission.yml new file mode 100644 index 0000000..ad456db --- /dev/null +++ b/.github/workflows/distribute-develop-mission.yml @@ -0,0 +1,17 @@ +name: Distribute PushOk (Develop / Mission PR Merge) + +on: + pull_request: + branches: + - develop + - mission/* + types: + - closed + +jobs: + call-reusable: + if: ${{ github.event.pull_request.merged == true }} + uses: ./.github/workflows/distribute-reusable.yml + with: + branch: ${{ github.base_ref }} + secrets: inherit diff --git a/.github/workflows/distribute-manual.yml b/.github/workflows/distribute-manual.yml new file mode 100644 index 0000000..8c21bc7 --- /dev/null +++ b/.github/workflows/distribute-manual.yml @@ -0,0 +1,11 @@ +name: Distribute PushOk (manual) + +on: + workflow_dispatch: + +jobs: + call-reusable: + uses: ./.github/workflows/distribute-reusable.yml + with: + branch: ${{ github.ref_name }} + secrets: inherit diff --git a/.github/workflows/distribute-release-support-mission.yml b/.github/workflows/distribute-release-support-mission.yml new file mode 100644 index 0000000..06ffa4c --- /dev/null +++ b/.github/workflows/distribute-release-support-mission.yml @@ -0,0 +1,19 @@ +name: Distribute PushOk (Release / Support / Mission PRs) + +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/distribute-reusable.yml + with: + branch: ${{ github.event.pull_request.head.ref }} + secrets: inherit diff --git a/.github/workflows/distribute-reusable.yml b/.github/workflows/distribute-reusable.yml new file mode 100644 index 0000000..f366954 --- /dev/null +++ b/.github/workflows/distribute-reusable.yml @@ -0,0 +1,30 @@ +name: Distribute PushOk - Reusable + +on: + 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: 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 }}\"" 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/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 new file mode 100644 index 0000000..3af9449 --- /dev/null +++ b/.github/workflows/lint_and_test.yml @@ -0,0 +1,49 @@ +name: UnitTests + Lint + +on: + push: + branches: + - develop + - mission/* + pull_request: + types: + - opened + - reopened + - synchronize + +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 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" diff --git a/.github/workflows/pr-description-validate.yml b/.github/workflows/pr-description-validate.yml index ee497c9..da05990 100644 --- a/.github/workflows/pr-description-validate.yml +++ b/.github/workflows/pr-description-validate.yml @@ -2,18 +2,18 @@ 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: 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-from-master-or-support.yml b/.github/workflows/publish-from-master-or-support.yml new file mode 100644 index 0000000..9f75a8f --- /dev/null +++ b/.github/workflows/publish-from-master-or-support.yml @@ -0,0 +1,16 @@ +name: SDK publish from master or support branch + +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/publish-manual.yml b/.github/workflows/publish-manual.yml new file mode 100644 index 0000000..c4f2669 --- /dev/null +++ b/.github/workflows/publish-manual.yml @@ -0,0 +1,22 @@ +name: SDK publish RC 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 diff --git a/.github/workflows/publish-reusable.yml b/.github/workflows/publish-reusable.yml new file mode 100644 index 0000000..37efa1a --- /dev/null +++ b/.github/workflows/publish-reusable.yml @@ -0,0 +1,111 @@ +name: SDK publish + +on: + workflow_call: + inputs: + branch: + required: true + type: string + +jobs: + checkingVersion: + name: Checking version + runs-on: ubuntu-latest + outputs: + 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!') + testing: + name: Testing + 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 + + releasing: + name: Releasing + 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 + + merge: + needs: [ releasing ] + if: | + 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 + 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" + - 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 diff --git a/.github/workflows/release-version-check.yml b/.github/workflows/release-version-check.yml new file mode 100644 index 0000000..fbdd6c5 --- /dev/null +++ b/.github/workflows/release-version-check.yml @@ -0,0 +1,50 @@ +name: Branch Protection + +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/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 610f00e..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Release to NPM - -on: - pull_request: - types: [closed] - branches: - - master - -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 }} - newVersion: ${{ fromJson(steps.package.outputs.content).target-version }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - 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] - if: needs.checkingVersion.outputs.isRunable == 'true' - runs-on: ubuntu-latest - steps: - - name: Checkout - 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 tests - run: yarn test - - releasing: - name: Releasing - needs: [checkingVersion, testing] - if: needs.checkingVersion.outputs.isRunable == 'true' - runs-on: ubuntu-latest - steps: - - name: Checkout - 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 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/trigger-build-app.yml b/.github/workflows/trigger-build-app.yml deleted file mode 100644 index 2b1aabd..0000000 --- a/.github/workflows/trigger-build-app.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Build application after merge - -on: - pull_request: - types: [closed] - branches: - - 'feature/*' - - 'develop' - -jobs: - trigger: - runs-on: macos-latest - if: github.event.pull_request.merged == true - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - 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]=\"${{ github.head_ref }}\"" \ - --form "variables[INPUT_COMMITS]=\"${{ env.commits }}\"" 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/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", diff --git a/git-release-branch.sh b/git-release-branch.sh index ac20e58..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 @@ -33,6 +30,43 @@ 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" + +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\", \"${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 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" + +git add "$changelog" echo "Branch $branch_name has been created." + +git commit -m "Bump SDK version to $version" --no-verify 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",