diff --git a/.circleci/config.yml b/.circleci/config.yml index 1ff08ff887..663e11f866 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2010,6 +2010,18 @@ jobs: git push origin git push --tags + deploy-to-purchases-ios-admob: + docker: + - image: cimg/base:stable + resource_class: small + steps: + - checkout + - revenuecat/setup-git-credentials + - revenuecat/trust-github-key + - run: + name: Deploy RevenueCatAdMob to purchases-ios-admob + command: ci_scripts/deploy-admob-spm.sh "${CIRCLE_TAG}" + bump-sdk-in-rc-mobile-app: docker: - image: cimg/ruby:3.2.0 @@ -2290,6 +2302,7 @@ workflows: - installation-tests-carthage - api-tests - spm-receipt-parser + - revenuecat-admob-tests - deploy-purchase-tester - run-all-maestro-e2e-tests - docs-build @@ -2307,6 +2320,10 @@ workflows: <<: *release-tags - deploy-to-spm: <<: *release-tags + - deploy-to-purchases-ios-admob: + requires: + - deploy-to-spm + <<: *release-tags - docs-deploy: <<: *release-tags - deploy-purchase-tester: @@ -2316,6 +2333,7 @@ workflows: requires: - push-revenuecatui-pod - deploy-to-spm + - deploy-to-purchases-ios-admob - docs-deploy - deploy-purchase-tester <<: *release-tags @@ -2577,6 +2595,7 @@ workflows: - installation-tests-all-but-carthage - installation-tests-carthage - api-tests + - revenuecat-admob-tests - deploy-purchase-tester - emerge_binary_size_analysis diff --git a/AdapterSDKs/RevenueCatAdMob/.gitignore b/AdapterSDKs/RevenueCatAdMob/.gitignore new file mode 100644 index 0000000000..b3c85f2ef5 --- /dev/null +++ b/AdapterSDKs/RevenueCatAdMob/.gitignore @@ -0,0 +1,6 @@ +Package.resolved +.build/ +.swiftpm/ +*.xcodeproj/ +Derived/ +Examples/ diff --git a/AdapterSDKs/RevenueCatAdMob/Package.resolved b/AdapterSDKs/RevenueCatAdMob/Package.resolved deleted file mode 100644 index 7a97443ce9..0000000000 --- a/AdapterSDKs/RevenueCatAdMob/Package.resolved +++ /dev/null @@ -1,23 +0,0 @@ -{ - "pins" : [ - { - "identity" : "swift-package-manager-google-mobile-ads", - "kind" : "remoteSourceControl", - "location" : "https://github.com/googleads/swift-package-manager-google-mobile-ads.git", - "state" : { - "revision" : "4458cfaeb502801c779dbb7fbd0121d198628f52", - "version" : "13.1.0" - } - }, - { - "identity" : "swift-package-manager-google-user-messaging-platform", - "kind" : "remoteSourceControl", - "location" : "https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git", - "state" : { - "revision" : "13b248eaa73b7826f0efb1bcf455e251d65ecb1b", - "version" : "3.1.0" - } - } - ], - "version" : 2 -} diff --git a/AdapterSDKs/RevenueCatAdMob/README.md b/AdapterSDKs/RevenueCatAdMob/README.md index 5072487fed..b30e64b8e3 100644 --- a/AdapterSDKs/RevenueCatAdMob/README.md +++ b/AdapterSDKs/RevenueCatAdMob/README.md @@ -12,6 +12,8 @@ The adapter is a **standalone Swift package** under `AdapterSDKs/RevenueCatAdMob ``` Then add the `RevenueCatAdMob` product to your target. + > **Note:** If your project depends on RevenueCat via SPM, use the [`purchases-ios-spm`](https://github.com/RevenueCat/purchases-ios-spm) package (not `purchases-ios`). The adapter's published package already declares this dependency correctly, but if you add RevenueCat separately, make sure both resolve from the same `purchases-ios-spm` repository to avoid duplicate package errors. + - **Swift Package Manager (local development):** To use the adapter from a local checkout of this repo, add the package by path to the `AdapterSDKs/RevenueCatAdMob` directory: ```swift .package(path: "path/to/purchases-ios/AdapterSDKs/RevenueCatAdMob") diff --git a/ci_scripts/deploy-admob-spm.sh b/ci_scripts/deploy-admob-spm.sh new file mode 100755 index 0000000000..0ced1b749c --- /dev/null +++ b/ci_scripts/deploy-admob-spm.sh @@ -0,0 +1,56 @@ +#!/bin/bash +set -euo pipefail + +# Deploys the RevenueCatAdMob adapter to the purchases-ios-admob SPM repo. +# Rewrites the local path dependency to a versioned dependency, then commits, tags, and pushes. +# +# Usage: +# ci_scripts/deploy-admob-spm.sh # commits, tags, and pushes +# ci_scripts/deploy-admob-spm.sh --dry-run # preview changes without pushing + +VERSION="${1:?Usage: deploy-admob-spm.sh [--dry-run]}" +DRY_RUN="${2:-}" + +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" +ADAPTER_DIR="${REPO_ROOT}/AdapterSDKs/RevenueCatAdMob" +WORK_DIR="$(mktemp -d)" +if [ "${DRY_RUN}" != "--dry-run" ]; then + trap 'rm -rf "${WORK_DIR}"' EXIT +fi + +# Clone the target repo +git clone git@github.com:RevenueCat/purchases-ios-admob.git "${WORK_DIR}" +cd "${WORK_DIR}" + +# Clear existing contents (except .git) +git rm -rf . 2>/dev/null || true + +# Copy adapter sources +cp -a "${ADAPTER_DIR}/." . + +# Rewrite Package.swift: replace local path dep with versioned dep +# sed -i behaves differently on macOS (requires '') vs Linux (no argument) +if [[ "$(uname)" == "Darwin" ]]; then + sed -i '' 's|.package(name: "purchases-ios", path: "../..")|.package(url: "https://github.com/RevenueCat/purchases-ios-spm.git", exact: "'"${VERSION}"'")|' Package.swift + sed -i '' 's|package: "purchases-ios"|package: "purchases-ios-spm"|' Package.swift +else + sed -i 's|.package(name: "purchases-ios", path: "../..")|.package(url: "https://github.com/RevenueCat/purchases-ios-spm.git", exact: "'"${VERSION}"'")|' Package.swift + sed -i 's|package: "purchases-ios"|package: "purchases-ios-spm"|' Package.swift +fi + +if [ "${DRY_RUN}" = "--dry-run" ]; then + echo "=== Dry run: showing rewritten Package.swift ===" + cat Package.swift + echo "" + echo "=== Files that would be committed ===" + git add -A + git status + echo "=== Dry run complete — remove --dry-run to push ===" + echo "=== Work dir kept at: ${WORK_DIR} ===" +else + git add -A + git commit -m "Release ${VERSION}" + git tag "${VERSION}" + git push origin main + git push origin "${VERSION}" +fi