Skip to content

Commit 37daefc

Browse files
committed
build(release): update CocoaPods lockfile during release
1 parent 84a44db commit 37daefc

11 files changed

Lines changed: 299 additions & 9 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,42 @@ jobs:
1313
publish_npm:
1414
if: "(github.repository == 'invertase/react-native-google-mobile-ads') && (github.event_name == 'workflow_dispatch')"
1515
name: 'NPM'
16-
timeout-minutes: 5
17-
runs-on: ubuntu-latest
16+
# Darwin + Xcode: semantic-release prepare refreshes RNGoogleMobileAdsExample/ios/Podfile.lock
17+
timeout-minutes: 60
18+
runs-on: macos-15
1819
permissions:
1920
contents: write # to be able to publish a GitHub release
2021
issues: write # to be able to comment on released issues
2122
pull-requests: write # to be able to comment on released pull requests
2223
id-token: write # Required for NPM OIDC Trusted Publish + Provenance
24+
env:
25+
XCODE_VERSION: latest-stable
2326
steps:
2427
- uses: actions/checkout@v5
2528
with:
2629
fetch-depth: 0
30+
token: ${{ secrets.GH_TOKEN }}
31+
- uses: maxim-lobanov/setup-xcode@v1
32+
with:
33+
xcode-version: ${{ env.XCODE_VERSION }}
2734
- uses: actions/setup-node@v6
2835
with:
2936
node-version: 24
37+
- name: Setup Ruby
38+
uses: ruby/setup-ruby@v1
39+
with:
40+
ruby-version: 3
41+
- name: Update Ruby build tools
42+
uses: nick-fields/retry@v3
43+
with:
44+
timeout_minutes: 2
45+
retry_wait_seconds: 60
46+
max_attempts: 3
47+
command: gem update cocoapods xcodeproj
3048
- name: Yarn Install
3149
uses: nick-fields/retry@v3
3250
with:
33-
timeout_minutes: 10
51+
timeout_minutes: 15
3452
retry_wait_seconds: 60
3553
max_attempts: 3
3654
command: yarn

‎.releaserc‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@
1414
["@semantic-release/npm", {
1515
"pkgRoot": "packages/core"
1616
}],
17+
"./scripts/semantic-release-refresh-ios-pod-lockfile.js",
1718
[
1819
"@semantic-release/git",
1920
{
2021
"assets": [
2122
"packages/core/package.json",
2223
"lerna.json",
23-
"CHANGELOG.md"
24+
"CHANGELOG.md",
25+
"RNGoogleMobileAdsExample/ios/Podfile.lock"
2426
],
2527
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
2628
}

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Reviews of Pull Requests are based on the following acceptance criteria:
122122
- E2E and Jest when [platform coverage](okf-bundle/testing/running-e2e.md#platform-coverage-gate-blocking) requires them.
123123
- Do all CI checks pass. A green e2e GitHub Actions job is not an e2e pass — [continue-on-error](okf-bundle/ci-workflows/index.md#e2e-continue-on-error).
124124

125-
Once a PR is merged into the `main` branch, maintainers publish with `workflow_dispatch` — [CI publish](okf-bundle/ci-workflows/index.md#workflows). Push to `main` does not publish.
125+
Once a PR is merged into the `main` branch, maintainers publish with `workflow_dispatch` — [CI publish](okf-bundle/ci-workflows/index.md#workflows). Push to `main` does not publish. Publish runs on macOS so the release commit refreshes `RNGoogleMobileAdsExample/ios/Podfile.lock` against `packages/core` (pod version + `sdkVersions.ios`) — [publish Podfile.lock](okf-bundle/ci-workflows/index.md#publish-podfile-lock).
126126

127127
## [No Brown M&M's](http://en.wikipedia.org/wiki/Van_Halen#Contract_riders)
128128

‎okf-bundle/ci-workflows/index.md‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,19 @@ Do not copy other repos’ Detox patch inventories, macOS-app e2e suites, Jacoco
1717
| Docs | [`.github/workflows/docs.yml`](../../.github/workflows/docs.yml) | `yarn lint:spellcheck` | Job title mentions Markdown; CI is spellcheck only — [§ lint](../testing/validation-checklist.md#lint-and-formatting) |
1818
| PR title | [`.github/workflows/pr_title.yml`](../../.github/workflows/pr_title.yml) | [documentation-policy § pull requests](../documentation-policy.md#pull-requests) | Conventional Commits; `validateSingleCommit` |
1919
| Test patches | [`.github/workflows/create_test_patches.yml`](../../.github/workflows/create_test_patches.yml) | Do not invent a local substitute | `workflow_dispatch` + push/PR; patch-package artifacts |
20-
| Publish | [`.github/workflows/publish.yml`](../../.github/workflows/publish.yml) | Maintainers only | `on.push` exists; the job `if` runs only on `workflow_dispatch`. Push to `main` does not publish. |
20+
| Publish | [`.github/workflows/publish.yml`](../../.github/workflows/publish.yml) | Maintainers only | `workflow_dispatch` only (`on.push` exists; job `if` ignores push). Runs on **macos-15** with Xcode + CocoaPods so semantic-release prepare can refresh `RNGoogleMobileAdsExample/ios/Podfile.lock` into the release commit ([§ publish Podfile.lock](#publish-podfile-lock)). |
2121
| Stale | [`.github/workflows/stale.yml`](../../.github/workflows/stale.yml) | n/a | Scheduled issue/PR stale bot |
2222

2323
Jest/e2e/patch workflows `paths-ignore` markdown and `docs/**` (YAML also lists `website/**`; that tree is not in this repo — ignore it). Lint runs on markdown PRs and pushes to `main`. Docs spellcheck is PR-only.
2424

25+
<a id="publish-podfile-lock"></a>
26+
27+
## Publish Podfile.lock refresh
28+
29+
After `@semantic-release/npm` bumps `packages/core/package.json`, the local prepare plugin `scripts/semantic-release-refresh-ios-pod-lockfile.js` runs `yarn release:refresh-ios-pod-lockfile` (Darwin-only): two `yarn tests:ios:pod:install` passes, asserts `RNGoogleMobileAds` / `Google-Mobile-Ads-SDK` / `GoogleUserMessagingPlatform` match `packages/core` version + `sdkVersions.ios`, then requires an idempotent `git diff --exit-code` on `RNGoogleMobileAdsExample/ios/Podfile.lock`. `@semantic-release/git` includes that lockfile in the release commit assets.
30+
31+
Do **not** delete `Podfile.lock` on routine `yarn tests:ios:pod:install` — install updates it in place. Pin-vs-lock drift (for example declared GMA `13.5.0` vs a stale lock) is fixed by that install or by the release refresh, not by wiping the lockfile. Local smoke without CocoaPods churn: `node ./scripts/refresh-ios-pod-lockfile.js --assert-pins-only` or `--self-check`. Commands: [agent command policy](../testing/agent-command-policy.md#canonical-registry).
32+
2533
<a id="e2e-continue-on-error"></a>
2634

2735
## E2e continue-on-error

‎okf-bundle/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ okf_version: '0.1'
77
- [Documentation/commit policy](documentation-policy.md#durable-vs-ephemeral) — three kinds (session scratch ephemeral under `.agents/`; gate state in internal tracker per policy; do not add ephemeral files here); [commits as documentation](documentation-policy.md#commits-as-documentation); [Efficiency](documentation-policy.md#efficiency); [OKF update contract](documentation-policy.md#okf-update-contract); [pull requests](documentation-policy.md#pull-requests)
88
- [Documentation site maintenance](documentation-site-maintenance.md) — docs.page [`docs.json`](documentation-site-maintenance.md#docsjson) + `docs/`
99
- [Architecture decisions](architecture-decisions.md) — `GMA-AD-*` (what + why); [GMA-AD-1](architecture-decisions.md#gma-ad-1); [GMA-AD-2](architecture-decisions.md#gma-ad-2)
10-
- [CI workflows](ci-workflows/index.md) — [§ workflows](ci-workflows/index.md#workflows); [e2e continue-on-error](ci-workflows/index.md#e2e-continue-on-error); [§ triage](ci-workflows/index.md#triage)
10+
- [CI workflows](ci-workflows/index.md) — [§ workflows](ci-workflows/index.md#workflows); [publish Podfile.lock](ci-workflows/index.md#publish-podfile-lock); [e2e continue-on-error](ci-workflows/index.md#e2e-continue-on-error); [§ triage](ci-workflows/index.md#triage)
1111
- [Testing](testing/index.md) — all testing files; [platform coverage](testing/running-e2e.md#platform-coverage-gate-blocking), [Expo plugin](testing/validation-checklist.md#expo-plugin), [coverage evidence](testing/coverage-design.md#coverage-evidence-package), [native agent collection](testing/coverage-design.md#native-agent-collection)

‎okf-bundle/testing/agent-command-policy.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ If a command is not listed (or linked) here, **do not run it**. E2e: [local e2e
2828
| Jest | `yarn tests:jest`, `yarn tests:jest-coverage` | `npx jest` random cwd |
2929
| Android JVM unit (Robolectric) | `yarn tests:android:unit` → example `./gradlew :react-native-google-mobile-ads:testDebugUnitTest` (sources under `packages/core/android/src/test/`; owned mapper/helper tests + harness smoke) | ad-hoc `./gradlew … testDebugUnitTest` outside this yarn script; treating library-folder standalone AGP as the gate |
3030
| iOS XCTest unit | `yarn tests:ios:unit` → `xcodebuild test` on `packages/core/ios/RNGoogleMobileAdsUnitTests.xcodeproj` (sources under `packages/core/ios/Tests/`; lightweight harness also compiles `RNGoogleMobileAdsOwnedMappers`; podspec `UnitTests` test_spec mirrors Tests) | ad-hoc `xcodebuild test` outside this yarn script |
31+
| iOS CocoaPods (example) | `yarn tests:ios:pod:install` (`pod install --repo-update` under `RNGoogleMobileAdsExample/ios/`; keeps `Podfile.lock`) | bare `pod install`; deleting `Podfile.lock` to “force” a refresh; assuming publish CI runs on Linux |
32+
| Release iOS lockfile refresh | `yarn release:refresh-ios-pod-lockfile` (Darwin; two `yarn tests:ios:pod:install` + pin assert + `git diff --exit-code` on `RNGoogleMobileAdsExample/ios/Podfile.lock`). Safe checks: `node ./scripts/refresh-ios-pod-lockfile.js --assert-pins-only` / `--self-check`. semantic-release prepare runs the full refresh on publish | inventing a second release path; refreshing lockfiles on Linux publish runners |
3133
| Lint (local) | [lint-by-tree](validation-checklist.md#lint-and-formatting) (`yarn lint:js` / `yarn lint:android` / `yarn lint:ios:check`; check vs `:fix`/`--replace` by work type) | ad-hoc eslint; `npx google-java-format`; invented `clang-format` / prettier |
3234
| Kotlin check (Android `.kt`) | repo-root `./gradlew ktlintCheck` (frozen review / check-only) | ad-hoc example `gradlew`; inventing yarn wrappers for ktlint |
3335
| Kotlin format (Android `.kt`) | repo-root `./gradlew ktlintFormat` (optional `-PinternalKtlintGitFilter=…`; implementation / documentation) | ad-hoc example `gradlew`; inventing yarn wrappers for ktlint |

‎okf-bundle/testing/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
* [Coverage design](coverage-design.md) — [touched-line bar](coverage-design.md#touched-line-bar); [§ evidence package](coverage-design.md#coverage-evidence-package) (`n/a` for `packages/core/app.plugin.js`-only unless plugin TS changed); [§ native agent collection](coverage-design.md#native-agent-collection) (`react-native-coverage` flush → `rn-coverage` pull/report; `yarn tests:jest-coverage` still owns TS); Android/iOS unit: `yarn tests:android:unit` / `yarn tests:ios:unit`
1010
* [Architecture decisions](../architecture-decisions.md) — `GMA-AD-*`; [GMA-AD-1 plugin path](../architecture-decisions.md#gma-ad-1); [GMA-AD-2 workspaces](../architecture-decisions.md#gma-ad-2)
1111
* [Documentation site maintenance](../documentation-site-maintenance.md) — user docs.page [`docs.json`](../documentation-site-maintenance.md#docsjson)
12-
* [CI workflows](../ci-workflows/index.md) — [§ workflows](../ci-workflows/index.md#workflows); [e2e continue-on-error](../ci-workflows/index.md#e2e-continue-on-error); [§ triage](../ci-workflows/index.md#triage)
12+
* [CI workflows](../ci-workflows/index.md) — [§ workflows](../ci-workflows/index.md#workflows); [publish Podfile.lock](../ci-workflows/index.md#publish-podfile-lock); [e2e continue-on-error](../ci-workflows/index.md#e2e-continue-on-error); [§ triage](../ci-workflows/index.md#triage)

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"tests:android:run": "yarn workspace RNGoogleMobileAdsExample android",
4444
"tests:android:unit": "cd RNGoogleMobileAdsExample/android && ./gradlew :react-native-google-mobile-ads:testDebugUnitTest",
4545
"tests:ios:run": "yarn workspace RNGoogleMobileAdsExample react-native run-ios",
46-
"tests:ios:pod:install": "cd RNGoogleMobileAdsExample && cd ios && rm -rf RNGoogleMobileAdsExample.xcworkspace && rm -f Podfile.lock && pod install --repo-update && cd ..",
46+
"tests:ios:pod:install": "cd RNGoogleMobileAdsExample/ios && pod install --repo-update",
47+
"release:refresh-ios-pod-lockfile": "node ./scripts/refresh-ios-pod-lockfile.js",
4748
"tests:ios:unit": "bash -c 'UDID=$(xcrun simctl list devices available | sed -n \"s/.*(\\([A-F0-9-]*\\)).*/\\1/p\" | head -1); test -n \"$UDID\" || { echo \"No available iOS Simulator\" >&2; exit 1; }; xcodebuild test -project packages/core/ios/RNGoogleMobileAdsUnitTests.xcodeproj -scheme RNGoogleMobileAdsUnitTests -destination \"id=$UDID\" CODE_SIGNING_ALLOWED=NO'",
4849
"tests:appium:validate": "yarn workspace @invertase/rngma-appium validate",
4950
"tests:appium:drivers:install": "yarn workspace @invertase/rngma-appium drivers:install",
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
'use strict';
2+
3+
const {
4+
assertPinsMatch,
5+
extractLockedPodVersion,
6+
selfCheck,
7+
} = require('../../../scripts/refresh-ios-pod-lockfile');
8+
9+
describe('refresh-ios-pod-lockfile helpers', () => {
10+
const sampleLock = `
11+
PODS:
12+
- Google-Mobile-Ads-SDK (13.5.0):
13+
- GoogleUserMessagingPlatform (>= 1.1)
14+
- GoogleUserMessagingPlatform (3.1.0)
15+
- RNGoogleMobileAds (16.5.0):
16+
`;
17+
18+
it('extracts top-level locked pod versions (ignores nested deps)', () => {
19+
expect(extractLockedPodVersion(sampleLock, 'RNGoogleMobileAds')).toBe('16.5.0');
20+
expect(extractLockedPodVersion(sampleLock, 'Google-Mobile-Ads-SDK')).toBe('13.5.0');
21+
expect(extractLockedPodVersion(sampleLock, 'GoogleUserMessagingPlatform')).toBe('3.1.0');
22+
expect(extractLockedPodVersion(sampleLock, 'MissingPod')).toBeUndefined();
23+
});
24+
25+
it('accepts matching package + SDK pins and rejects GMA drift', () => {
26+
const okPkg = {
27+
version: '16.5.0',
28+
sdkVersions: { ios: { googleMobileAds: '13.5.0', googleUmp: '3.1.0' } },
29+
};
30+
expect(assertPinsMatch(okPkg, sampleLock)).toEqual({
31+
packageVersion: '16.5.0',
32+
googleMobileAds: '13.5.0',
33+
googleUmp: '3.1.0',
34+
});
35+
36+
expect(() =>
37+
assertPinsMatch(
38+
{
39+
version: '16.5.0',
40+
sdkVersions: { ios: { googleMobileAds: '13.1.0', googleUmp: '3.1.0' } },
41+
},
42+
sampleLock,
43+
),
44+
).toThrow(/Google-Mobile-Ads-SDK/);
45+
});
46+
47+
it('self-check exercises accept and reject paths', () => {
48+
expect(() => selfCheck()).not.toThrow();
49+
});
50+
});
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
'use strict';
2+
3+
/**
4+
* Refresh the example iOS CocoaPods lockfile so release commits keep
5+
* RNGoogleMobileAdsExample/ios/Podfile.lock aligned with packages/core
6+
* (pod version + sdkVersions.ios pins). Mirrors the Darwin path in RNFB
7+
* scripts/version.js, adapted for semantic-release.
8+
*
9+
* Usage:
10+
* node ./scripts/refresh-ios-pod-lockfile.js
11+
* node ./scripts/refresh-ios-pod-lockfile.js --assert-pins-only
12+
* node ./scripts/refresh-ios-pod-lockfile.js --self-check
13+
* yarn release:refresh-ios-pod-lockfile
14+
*/
15+
16+
const { execSync } = require('child_process');
17+
const { existsSync, readFileSync } = require('fs');
18+
const path = require('path');
19+
20+
const REPO_ROOT = path.resolve(__dirname, '..');
21+
const PACKAGE_JSON_PATH = path.join(REPO_ROOT, 'packages/core/package.json');
22+
const PODFILE_LOCK_PATH = path.join(REPO_ROOT, 'RNGoogleMobileAdsExample/ios/Podfile.lock');
23+
const POD_LOCKFILE_RELATIVE = 'RNGoogleMobileAdsExample/ios/Podfile.lock';
24+
25+
function readCorePackage(packageJsonPath = PACKAGE_JSON_PATH) {
26+
return JSON.parse(readFileSync(packageJsonPath, 'utf8'));
27+
}
28+
29+
function extractLockedPodVersion(lockfileContents, podName) {
30+
// Top-level PODS entries use exactly two spaces before `-` (nested deps use four+).
31+
const escaped = podName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
32+
const match = lockfileContents.match(new RegExp(`^ - ${escaped} \\(([^)]+)\\)`, 'm'));
33+
return match ? match[1] : undefined;
34+
}
35+
36+
function assertPinsMatch(packageJson, lockfileContents) {
37+
const expectedPackageVersion = packageJson.version;
38+
const expectedGma = packageJson.sdkVersions && packageJson.sdkVersions.ios.googleMobileAds;
39+
const expectedUmp = packageJson.sdkVersions && packageJson.sdkVersions.ios.googleUmp;
40+
41+
if (!expectedPackageVersion || !expectedGma || !expectedUmp) {
42+
throw new Error(
43+
'packages/core/package.json missing version or sdkVersions.ios.googleMobileAds/googleUmp',
44+
);
45+
}
46+
47+
const lockedPackage = extractLockedPodVersion(lockfileContents, 'RNGoogleMobileAds');
48+
const lockedGma = extractLockedPodVersion(lockfileContents, 'Google-Mobile-Ads-SDK');
49+
const lockedUmp = extractLockedPodVersion(lockfileContents, 'GoogleUserMessagingPlatform');
50+
51+
const mismatches = [];
52+
if (lockedPackage !== expectedPackageVersion) {
53+
mismatches.push(
54+
`RNGoogleMobileAds lock=${lockedPackage} package.json=${expectedPackageVersion}`,
55+
);
56+
}
57+
if (lockedGma !== expectedGma) {
58+
mismatches.push(
59+
`Google-Mobile-Ads-SDK lock=${lockedGma} sdkVersions.ios.googleMobileAds=${expectedGma}`,
60+
);
61+
}
62+
if (lockedUmp !== expectedUmp) {
63+
mismatches.push(
64+
`GoogleUserMessagingPlatform lock=${lockedUmp} sdkVersions.ios.googleUmp=${expectedUmp}`,
65+
);
66+
}
67+
68+
if (mismatches.length > 0) {
69+
throw new Error(
70+
`Podfile.lock pins out of sync with packages/core:\n- ${mismatches.join('\n- ')}`,
71+
);
72+
}
73+
74+
return {
75+
packageVersion: expectedPackageVersion,
76+
googleMobileAds: expectedGma,
77+
googleUmp: expectedUmp,
78+
};
79+
}
80+
81+
function assertCurrentPins() {
82+
if (!existsSync(PACKAGE_JSON_PATH)) {
83+
throw new Error(`missing ${PACKAGE_JSON_PATH}`);
84+
}
85+
if (!existsSync(PODFILE_LOCK_PATH)) {
86+
throw new Error(`missing ${PODFILE_LOCK_PATH}`);
87+
}
88+
return assertPinsMatch(readCorePackage(), readFileSync(PODFILE_LOCK_PATH, 'utf8'));
89+
}
90+
91+
function runPodInstall() {
92+
execSync('yarn tests:ios:pod:install', { cwd: REPO_ROOT, stdio: 'inherit' });
93+
}
94+
95+
function stageAndVerifyIdempotent() {
96+
execSync(`git add -- ${POD_LOCKFILE_RELATIVE}`, { cwd: REPO_ROOT, stdio: 'inherit' });
97+
runPodInstall();
98+
execSync(`git diff --exit-code -- ${POD_LOCKFILE_RELATIVE}`, {
99+
cwd: REPO_ROOT,
100+
stdio: 'inherit',
101+
});
102+
}
103+
104+
function refreshIosPodLockfile(options = {}) {
105+
const { requireDarwin = true } = options;
106+
107+
if (requireDarwin && process.platform !== 'darwin') {
108+
throw new Error(
109+
'refresh-ios-pod-lockfile requires Darwin (CocoaPods). Publish CI must run on macOS.',
110+
);
111+
}
112+
113+
console.log('Refreshing example iOS Podfile.lock via yarn tests:ios:pod:install…');
114+
runPodInstall();
115+
const pins = assertCurrentPins();
116+
console.log(
117+
`Pins OK after refresh: RNGoogleMobileAds=${pins.packageVersion} GMA=${pins.googleMobileAds} UMP=${pins.googleUmp}`,
118+
);
119+
120+
// Second install verifies the staged lockfile is idempotent (RNFB #9208 pattern).
121+
stageAndVerifyIdempotent();
122+
console.log(`Idempotent: ${POD_LOCKFILE_RELATIVE}`);
123+
return pins;
124+
}
125+
126+
function selfCheck() {
127+
const sampleLock = `
128+
PODS:
129+
- Google-Mobile-Ads-SDK (13.5.0):
130+
- GoogleUserMessagingPlatform (>= 1.1)
131+
- GoogleUserMessagingPlatform (3.1.0)
132+
- RNGoogleMobileAds (16.5.0):
133+
`;
134+
const okPkg = {
135+
version: '16.5.0',
136+
sdkVersions: { ios: { googleMobileAds: '13.5.0', googleUmp: '3.1.0' } },
137+
};
138+
const badPkg = {
139+
version: '16.5.0',
140+
sdkVersions: { ios: { googleMobileAds: '13.1.0', googleUmp: '3.1.0' } },
141+
};
142+
143+
assertPinsMatch(okPkg, sampleLock);
144+
let rejected = false;
145+
try {
146+
assertPinsMatch(badPkg, sampleLock);
147+
} catch (error) {
148+
rejected = /Google-Mobile-Ads-SDK/.test(String(error && error.message));
149+
}
150+
if (!rejected) {
151+
throw new Error('self-check failed: drifted GMA pin must reject');
152+
}
153+
154+
if (extractLockedPodVersion(sampleLock, 'RNGoogleMobileAds') !== '16.5.0') {
155+
throw new Error('self-check failed: RNGoogleMobileAds extract');
156+
}
157+
158+
console.log('refresh-ios-pod-lockfile self-check: ok');
159+
}
160+
161+
function main(argv = process.argv.slice(2)) {
162+
if (argv.includes('--self-check')) {
163+
selfCheck();
164+
return;
165+
}
166+
if (argv.includes('--assert-pins-only')) {
167+
const pins = assertCurrentPins();
168+
console.log(
169+
`Pins OK: RNGoogleMobileAds=${pins.packageVersion} GMA=${pins.googleMobileAds} UMP=${pins.googleUmp}`,
170+
);
171+
return;
172+
}
173+
refreshIosPodLockfile();
174+
}
175+
176+
module.exports = {
177+
POD_LOCKFILE_RELATIVE,
178+
assertPinsMatch,
179+
assertCurrentPins,
180+
extractLockedPodVersion,
181+
refreshIosPodLockfile,
182+
selfCheck,
183+
};
184+
185+
if (require.main === module) {
186+
try {
187+
main();
188+
} catch (error) {
189+
console.error(error && error.message ? error.message : error);
190+
process.exit(1);
191+
}
192+
}

0 commit comments

Comments
 (0)