Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ jobs:
- name: Build packages
run: yarn turbo run build --filter='./packages/*'

# Validate the semantic-release config without publishing, so a broken
# .releaserc or publish script is caught on PRs rather than at release time.
- name: Release dry run
working-directory: packages/webgpu
run: yarn semantic-release --dry-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
YARN_NPM_AUTH_TOKEN: ''
NPM_TOKEN: ''

# Build the docs site the same way the Pages deploy does (GITHUB_PAGES set,
# so the project base path is applied) to catch broken links / build
# regressions before they reach main.
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Create a release
on: workflow_dispatch

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # to push tags and create the GitHub release
issues: write # to comment on released issues
pull-requests: write # to comment on released pull requests
id-token: write # to mint the OIDC token for npm provenance / trusted publishing
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # semantic-release needs full history and tags

- name: Setup
uses: ./.github/actions/setup
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

# Tokenless trusted publishing requires npm >= 11.5; Node 22 ships npm 10.
- name: Upgrade npm
run: npm install -g npm@latest

- name: Build packages
run: yarn turbo run build --filter='./packages/*'

- name: Release
working-directory: packages/webgpu
run: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Trusted publishing authenticates via the OIDC id-token, so no npm
# token is needed. These are set empty so semantic-release-yarn's
# verifyConditions step does not trip on a missing token.
YARN_NPM_AUTH_TOKEN: ''
NPM_TOKEN: ''
NPM_CONFIG_PROVENANCE: true
2 changes: 1 addition & 1 deletion apps/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3074,7 +3074,7 @@ SPEC CHECKSUMS:
React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b
react-native-safe-area-context: c00143b4823773bba23f2f19f85663ae89ceb460
react-native-skia: fc73e9bdc46ebb420a98c9c2be29fee80f565e79
react-native-webgpu: 02d51c1d86e4d653de06bdc954d2f693dcead7a5
react-native-webgpu: 7a604a7936a2e3fdc93bd48813bcba0165ada8cc
React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3
React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d
React-perflogger: 5536d2df3d18fe0920263466f7b46a56351c0510
Expand Down
6 changes: 5 additions & 1 deletion apps/example/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ const getWebMetroConfig = require('./getWebMetroConfig');
const root = path.resolve(__dirname, '../..');
const threePackagePath = path.resolve(root, 'node_modules/three');

const r3fPath = path.resolve(root, "node_modules/@react-three/fiber");
// @react-three/fiber may be hoisted to the monorepo root or kept in the app's
// own node_modules, so resolve it instead of assuming a fixed location.
const r3fPath = path.dirname(
require.resolve("@react-three/fiber/package.json"),
);
const defaultConfig = getDefaultConfig(__dirname);

const customConfig = {
Expand Down
6 changes: 4 additions & 2 deletions packages/webgpu-shim/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-wgpu",
"version": "0.5.15",
"version": "0.0.0-development",
"description": "Shim that re-exports react-native-webgpu under its previous package name",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down Expand Up @@ -34,7 +34,9 @@
},
"homepage": "https://github.com/wcandillon/react-native-webgpu#readme",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
"registry": "https://registry.npmjs.org/",
"access": "public",
"provenance": true
},
"dependencies": {
"react-native-webgpu": "*"
Expand Down
28 changes: 28 additions & 0 deletions packages/webgpu/.releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"semantic-release-yarn",
{
"npmPublish": false,
"tarballDir": "dist"
}
],
[
"@semantic-release/exec",
{
"publishCmd": "bash scripts/release/publish.sh ${nextRelease.version} ${nextRelease.channel || 'latest'}"
}
],
[
"@semantic-release/github",
{
"assets": [
{ "path": "dist/*.tgz", "label": "Package tarball" }
]
}
]
]
}
13 changes: 11 additions & 2 deletions packages/webgpu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-webgpu",
"version": "0.5.15",
"version": "0.0.0-development",
"description": "React Native WebGPU",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand All @@ -27,6 +27,7 @@
"lint": "eslint . --ext .ts,.tsx --max-warnings 0 --cache --fix",
"tsc": "tsc --noEmit",
"build": "bob build",
"release": "semantic-release",
"build-dawn": "tsx scripts/build/dawn.ts",
"clean-dawn": "rimraf ./libs && rimraf ../../externals/dawn/out",
"clang-format": "yarn clang-format-ios && yarn clang-format-android && yarn clang-format-common",
Expand All @@ -53,9 +54,15 @@
},
"homepage": "https://wcandillon.github.io/react-native-webgpu/",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
"registry": "https://registry.npmjs.org/",
"access": "public",
"provenance": true
},
"devDependencies": {
"@semantic-release/commit-analyzer": "^13.0.0",
"@semantic-release/exec": "^7.0.3",
"@semantic-release/github": "^10.3.3",
"@semantic-release/release-notes-generator": "^14.0.1",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.5",
"@types/node": "^20.14.7",
Expand Down Expand Up @@ -87,6 +94,8 @@
"react-native-worklets": "0.8.3",
"rimraf": "^5.0.7",
"seedrandom": "^3.0.5",
"semantic-release": "^24.1.0",
"semantic-release-yarn": "^3.0.2",
"teapot": "^1.0.0",
"ts-morph": "^22.0.0",
"tsx": "^4.20.5",
Expand Down
31 changes: 31 additions & 0 deletions packages/webgpu/scripts/release/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# Invoked by @semantic-release/exec (publishCmd) with the resolved version and
# dist-tag channel. semantic-release-yarn has already bumped
# packages/webgpu/package.json to $VERSION and packed the tarball into dist/.
#
# Publishes react-native-webgpu and its react-native-wgpu shim to npm in
# lockstep, both with provenance via the workflow's OIDC token (no NPM token).
set -euo pipefail

VERSION="$1"
CHANNEL="${2:-latest}"

PKG_DIR="$(cd "$(dirname "$0")/../.." && pwd)" # packages/webgpu
SHIM_DIR="$(cd "$PKG_DIR/../webgpu-shim" && pwd)" # packages/webgpu-shim
STAGING="$(mktemp -d)"
trap 'rm -rf "$STAGING"' EXIT

# 1. react-native-webgpu: publish the tarball semantic-release-yarn produced.
# Copy into a clean staging dir so only the intended tarball is present.
echo "Publishing react-native-webgpu@$VERSION (tag: $CHANNEL)"
cp "$PKG_DIR"/dist/*.tgz "$STAGING/"
( cd "$STAGING" && npm publish ./*.tgz --provenance --access public --tag "$CHANNEL" )
rm -f "$STAGING"/*.tgz

# 2. react-native-wgpu shim: same version, pinned to the matching release.
# lib/ was built by `yarn build` earlier in the release workflow.
echo "Publishing react-native-wgpu@$VERSION (tag: $CHANNEL)"
( cd "$SHIM_DIR" && npm pkg set version="$VERSION" dependencies.react-native-webgpu="$VERSION" )
( cd "$SHIM_DIR" && yarn pack --out "$STAGING/react-native-wgpu.tgz" )
( cd "$STAGING" && npm publish ./react-native-wgpu.tgz --provenance --access public --tag "$CHANNEL" )
Loading
Loading