Skip to content

Commit 1b69bda

Browse files
jaymaycryclaude
andcommitted
chore: bootstrap release-please + project conventions
Replaces the previous release workflow with release-please-action, wired to publish via npm Trusted Publishing (OIDC) on tag creation. The manifest pins the current version at 0.1.0 with bootstrap-sha set to the last commit before automated releases started, so the next release PR will pick up the iOS fix as 0.1.1. Adds AGENTS.md (Conventional Commits rules, release flow, things to avoid) and CLAUDE.md as a pointer to it, plus a Releasing section in README, so future contributors and agents follow the same conventions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 18bf4b4 commit 1b69bda

6 files changed

Lines changed: 194 additions & 14 deletions

File tree

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
1-
name: Release
1+
name: Release Please
22

33
on:
44
push:
5-
tags:
6-
- 'v*'
5+
branches: [main]
76

87
permissions:
9-
contents: read
10-
id-token: write
8+
contents: write
9+
pull-requests: write
1110

1211
jobs:
12+
release-please:
13+
name: Release PR / tag
14+
runs-on: ubuntu-latest
15+
outputs:
16+
release_created: ${{ steps.release.outputs.release_created }}
17+
tag_name: ${{ steps.release.outputs.tag_name }}
18+
steps:
19+
- uses: googleapis/release-please-action@v4
20+
id: release
21+
with:
22+
config-file: release-please-config.json
23+
manifest-file: .release-please-manifest.json
24+
1325
publish:
1426
name: Publish to npm
27+
needs: release-please
28+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
1529
runs-on: ubuntu-latest
30+
permissions:
31+
contents: read
32+
id-token: write
1633
steps:
1734
- name: Checkout
1835
uses: actions/checkout@v4
@@ -27,15 +44,6 @@ jobs:
2744
- name: Install dependencies
2845
run: yarn install --frozen-lockfile
2946

30-
- name: Verify tag matches package.json version
31-
run: |
32-
PKG_VERSION=$(node -p "require('./package.json').version")
33-
TAG_VERSION="${GITHUB_REF_NAME#v}"
34-
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
35-
echo "Tag $GITHUB_REF_NAME (version $TAG_VERSION) does not match package.json version $PKG_VERSION"
36-
exit 1
37-
fi
38-
3947
- name: Build
4048
run: yarn prepare
4149

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.1.0"
3+
}

AGENTS.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# AGENTS.md
2+
3+
Project conventions for AI coding agents working in this repo. Read this
4+
before making changes — most of it is not derivable from the code alone.
5+
6+
## What this repo is
7+
8+
A React Native Turbo Module (`@panter/react-native-motiontag`) wrapping
9+
the MotionTag tracking SDKs (iOS 6.5.x, Android 7.2.x). New architecture
10+
only. JS surface mirrors the official Flutter SDK so payloads stay
11+
interchangeable.
12+
13+
Repo layout: see [README.md → Repo layout](README.md#repo-layout).
14+
15+
## Commit conventions
16+
17+
This repo uses [Conventional Commits](https://www.conventionalcommits.org/),
18+
enforced by release-please. **Every commit subject to `main` must follow the
19+
format** or it won't appear in the changelog and may break automated
20+
versioning.
21+
22+
| Prefix | Meaning | Version bump |
23+
| --- | --- | --- |
24+
| `feat:` | New user-facing feature | minor |
25+
| `fix:` | Bug fix | patch |
26+
| `feat!:` / `fix!:` / `BREAKING CHANGE:` body | Breaking change | major |
27+
| `chore:` | Tooling, deps, internal cleanup | none |
28+
| `docs:` | Documentation only | none |
29+
| `refactor:` | Internal restructure, no behaviour change | none |
30+
| `test:` | Test-only changes | none |
31+
| `ci:` | CI / workflow changes | none |
32+
| `build:` | Build system changes | none |
33+
34+
Optional scope in parentheses: `feat(plugin): add channelId option`,
35+
`fix(android): handle null permission result`.
36+
37+
Do **not** add a trailing summary paragraph in commit bodies that repeats
38+
the subject. Body explains *why*; subject already says *what*.
39+
40+
## Release flow
41+
42+
Releases are automated — agents must not run `npm publish` directly or
43+
push tags manually. See [README → Releasing](README.md#releasing) for the
44+
full flow. TL;DR: commit with Conventional Commits → release-please opens
45+
a release PR → merging it tags + publishes via GitHub Actions OIDC.
46+
47+
## Working with the code
48+
49+
- **Library source**: `src/` — TypeScript, no transpilation in the example
50+
(uses the `react-native` field in `package.json` to consume `src/` directly).
51+
- **Native modules**: `android/` (Kotlin) and `ios/` (Swift + ObjC++).
52+
Changing the TS spec (`src/NativeMotionTag.ts`) regenerates the codegen
53+
contract — both native sides must be updated to match.
54+
- **Expo config plugin**: `plugin/` (plain JS, no build). Injected blocks
55+
are wrapped in `@generated` markers and de-duplicated on `expo prebuild`
56+
re-runs.
57+
- **Example app**: `example/` is a Standalone Expo dev-client app. It
58+
declares the library via `"file:.."` so edits to `src/` hot-reload via
59+
Fast Refresh. Metro config in `example/metro.config.js` blocks duplicate
60+
`react` / `react-native` copies — do not change without understanding
61+
why.
62+
63+
## Build / verify
64+
65+
- TypeScript build: `yarn prepare` (runs `react-native-builder-bob`,
66+
outputs `lib/{commonjs,module,typescript}`).
67+
- Typecheck only: `npx tsc -p tsconfig.build.json --noEmit`.
68+
- Lint: none configured yet. Don't add one without asking.
69+
- Tests: none yet. Don't add a test framework speculatively.
70+
- The CI workflow (`.github/workflows/ci.yml`) runs `yarn prepare` on PRs;
71+
if your change touches `src/`, make sure it builds cleanly locally first.
72+
73+
## What to avoid
74+
75+
- Don't bump `version` in `package.json` by hand — release-please owns it.
76+
- Don't edit `CHANGELOG.md` by hand — release-please owns it.
77+
- Don't edit `.release-please-manifest.json` unless intentionally
78+
bootstrapping (extremely rare).
79+
- Don't add a `prepublishOnly` or other publish-side hook that would race
80+
with `prepare` in the GitHub Actions workflow.
81+
- Don't add Expo Go support — the library has native code and requires a
82+
development client build. Documentation that suggests otherwise is wrong.
83+
- Don't align the iOS and Android SDK versions opportunistically. Version
84+
drift is intentional pending a separate evaluation (tracked as a
85+
follow-up). Touch only when explicitly asked.
86+
- Don't introduce a monorepo tool (Lerna, Nx, Turborepo). The
87+
library + `example/` two-package layout is deliberate.
88+
89+
## Native dependency versions
90+
91+
Hard-coded; see [README → Native dependency versions](README.md#native-dependency-versions).
92+
Bumping these is a feature change with cross-platform implications —
93+
treat as a `feat:` (or `feat!:` if API-incompatible) and update both
94+
platforms in the same PR.
95+
96+
## When in doubt
97+
98+
Ask. The MotionTag SDK has thin, sometimes surprising native contracts
99+
(pre-RN init requirements, background task identifiers, foreground-service
100+
ownership) that aren't obvious from the JS surface — better to confirm
101+
than to guess.

CLAUDE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# CLAUDE.md
2+
3+
See [AGENTS.md](AGENTS.md) for project conventions, commit format, release
4+
flow, and what to avoid when making changes in this repo.

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ SDK v7.2.x — the platform asymmetry is hidden behind a shared TS contract.
1818
- [Running the example app](#running-the-example-app)
1919
- [Repo layout](#repo-layout)
2020
- [Developing the package](#developing-the-package)
21+
- [Releasing](#releasing)
2122

2223
## Install in your app
2324

@@ -266,3 +267,54 @@ re-install.
266267
- **Iterate on the Expo config plugin** by editing files in `plugin/` and
267268
re-running `npx expo prebuild --clean` in `example/`. The injected blocks
268269
are wrapped in `@generated` markers and de-duplicated on re-run.
270+
271+
## Releasing
272+
273+
Releases are fully automated via [release-please](https://github.com/googleapis/release-please)
274+
and npm Trusted Publishing — no manual `npm publish`, no tokens, no
275+
hand-edited changelog.
276+
277+
### The flow
278+
279+
1. Land commits on `main` using [Conventional Commits](https://www.conventionalcommits.org/):
280+
- `feat: …` — minor bump (`0.1.0``0.2.0`)
281+
- `fix: …` — patch bump (`0.1.0``0.1.1`)
282+
- `feat!: …` or `BREAKING CHANGE:` in body — major bump
283+
- `chore:`, `docs:`, `refactor:`, `test:`, `ci:` — no bump, but appear
284+
in the changelog under their respective sections
285+
2. The **Release Please** workflow opens (or updates) a PR titled
286+
`chore(main): release X.Y.Z`. The PR contains the version bump in
287+
`package.json`, an updated `CHANGELOG.md` assembled from the commit
288+
subjects since the last release, and an updated
289+
`.release-please-manifest.json`.
290+
3. Merge that PR when you're ready to release. Release-please then creates
291+
the git tag (`vX.Y.Z`) and a matching GitHub Release with the changelog
292+
body.
293+
4. The `publish` job in the same workflow runs `yarn prepare` (bob build)
294+
and `npm publish` with npm provenance attached via OIDC.
295+
296+
### One-time npm setup
297+
298+
On npmjs.com → `@panter/react-native-motiontag`*Settings*
299+
*Trusted Publisher**Add*:
300+
301+
- Publisher: GitHub Actions
302+
- Organization: `panter`
303+
- Repository: `react-native-motiontag`
304+
- Workflow filename: `release-please.yml`
305+
- Environment: *(leave blank)*
306+
307+
No `NPM_TOKEN` secret is required.
308+
309+
### Hotfix / manual override
310+
311+
If you need to publish a version that release-please can't produce (e.g. a
312+
hotfix from a non-`main` branch), bump `package.json` + push manually:
313+
314+
```sh
315+
yarn prepare
316+
npm publish --access public
317+
```
318+
319+
You'll need a local npm auth token for the manual path — Trusted
320+
Publishing only covers the GitHub Actions workflow.

release-please-config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"packages": {
4+
".": {
5+
"release-type": "node",
6+
"package-name": "@panter/react-native-motiontag",
7+
"changelog-path": "CHANGELOG.md",
8+
"include-component-in-tag": false,
9+
"bootstrap-sha": "2f359f499f13bf49c42c7ab2c648c96fe94420c0"
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)