Skip to content

Commit a612b96

Browse files
robingenzclaude
andauthored
ci: release-please publishes the module over OIDC
The release setup for the 0.1.0 release of the four SDKs, the same as the CLI's: release-please opens the release PR, the publish job uses npm's trusted publishing over OIDC and refuses to publish a pkg.pr.new dependency. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent f5d5d01 commit a612b96

8 files changed

Lines changed: 76 additions & 5 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
release-please:
15+
name: Release Please
16+
if: github.repository == 'hotcodepush-team/react-native-code-push'
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
issues: write
21+
pull-requests: write
22+
outputs:
23+
release_created: ${{ steps.release.outputs.release_created }}
24+
tag_name: ${{ steps.release.outputs.tag_name }}
25+
steps:
26+
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
27+
id: release
28+
29+
publish:
30+
name: Publish to npm
31+
needs: release-please
32+
if: needs.release-please.outputs.release_created == 'true'
33+
runs-on: ubuntu-latest
34+
permissions:
35+
contents: read
36+
id-token: write
37+
steps:
38+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
39+
with:
40+
ref: ${{ needs.release-please.outputs.tag_name }}
41+
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
42+
with:
43+
node-version-file: .nvmrc
44+
registry-url: https://registry.npmjs.org
45+
- run: npm ci
46+
- name: Refuse a pkg.pr.new dependency, which npm would publish as it is
47+
run: '! grep -qF pkg.pr.new package.json'
48+
- run: npm publish --provenance --access public

‎.prettierignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ dist
44
ios
55
node_modules
66
package-lock.json
7+
8+
# Written by release-please
9+
.release-please-manifest.json
10+
CHANGELOG.md

‎.release-please-manifest.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

‎CLAUDE.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ Consumers pin the preview builds pkg.pr.new publishes from `ci.yml` on every pus
5656
A consumer pins a commit and bumps it deliberately — never `@main`, whose moving content breaks `npm ci` against the lockfile's integrity hash.
5757
The shared types come from `@hotcodepush/protocol` the same way, pinned to a commit in `package.json`; a protocol change is a bump of that sha.
5858

59+
## Releases
60+
61+
Release-please keeps a release pull request open on `main`, and merging it tags the release.
62+
`release.yml` then publishes to npm with provenance over OIDC, `prepublishOnly` running the build first, so the package carries the cores the build downloads.
63+
A published package never depends on a pkg.pr.new URL: the protocol pin above moves to its npm release, `^0.1.0`, before this package's first release.
64+
5965
## Rules
6066

6167
- The SDK never sees an API DTO: its contract is the channel index, the bundle manifest and the events endpoint, additive only.

‎benchmarks/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The simulator app grows by about 3.5 MB, nearly all of it in the `HotCodePushDem
3333

3434
```sh
3535
npm run build && npm pack --pack-destination /tmp
36-
node benchmarks/prepare-demo.mjs ../react-native-code-push-demo /tmp/baseline/with with /tmp/hotcodepush-react-native-code-push-0.0.0.tgz
36+
node benchmarks/prepare-demo.mjs ../react-native-code-push-demo /tmp/baseline/with with /tmp/hotcodepush-react-native-code-push-*.tgz
3737
node benchmarks/prepare-demo.mjs ../react-native-code-push-demo /tmp/baseline/without without
3838
node benchmarks/measure-size.mjs /tmp/baseline/with
3939
node benchmarks/measure-size.mjs /tmp/baseline/without

‎package-lock.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "@hotcodepush/react-native-code-push",
3-
"version": "0.0.0",
3+
"version": "0.0.1",
44
"description": "React Native code push by HotCodePush: the module that delivers over-the-air (OTA) updates to your React Native app",
55
"license": "MIT",
66
"author": "Genz IT Solutions GmbH",
7-
"homepage": "https://hotcodepush.com/react-native-code-push",
7+
"homepage": "https://hotcodepush.com/docs/sdks/react-native",
88
"repository": {
99
"type": "git",
1010
"url": "git+https://github.com/hotcodepush-team/react-native-code-push.git"
@@ -48,6 +48,7 @@
4848
"clean": "rimraf ./dist",
4949
"fmt": "eslint . --fix && prettier --write . && swiftlint --fix --quiet ios",
5050
"lint": "eslint . && prettier --check . && swiftlint lint --quiet --strict ios",
51+
"prepublishOnly": "npm run build",
5152
"test": "vitest run",
5253
"typecheck": "tsc --noEmit",
5354
"verify": "npm run lint && npm run typecheck && npm test && npm run build",

‎release-please-config.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"release-type": "node",
4+
"bump-minor-pre-major": true,
5+
"bump-patch-for-minor-pre-major": true,
6+
"include-component-in-tag": false,
7+
"initial-version": "0.1.0",
8+
"packages": {
9+
".": {}
10+
}
11+
}

0 commit comments

Comments
 (0)