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
20 changes: 15 additions & 5 deletions .github/workflows/npm-publish-satellites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
if: github.repository == 'software-mansion/react-native-executorch'
runs-on: ubuntu-latest
environment: deployment
env:
# The core package's postinstall downloads the native artifacts. Packing a
# satellite runs tsc against the core's type declarations and needs none
# of them.
RNET_SKIP_DOWNLOAD: 1
permissions:
# `contents: write` is required when perform-git-operations pushes a tag.
contents: write
Expand Down Expand Up @@ -97,9 +102,12 @@ jobs:
with:
package-name: 'react-native-executorch-bare-resource-fetcher'
package-json-path: 'packages/bare-resource-fetcher/package.json'
# Satellites type-check against the core package's published type
# declarations, so build it before packing the satellite.
install-dependencies-command: 'yarn install --immutable && yarn workspace react-native-executorch prepare'
# `workspaces focus` installs this satellite and the workspaces it
# depends on, instead of the whole monorepo: the root globs pull in
# eight React Native example apps, 1660 packages and 597 MiB, to build
# one small package. Satellites type-check against the core package's
# type declarations, so it still gets built before the satellite packs.
install-dependencies-command: 'yarn workspaces focus react-native-executorch-bare-resource-fetcher && yarn workspace react-native-executorch prepare'
release-type: ${{ inputs.release-type }}
version: ${{ steps.version.outputs.version }}
perform-git-operations: ${{ inputs.perform-git-operations }}
Expand All @@ -111,7 +119,8 @@ jobs:
with:
package-name: 'react-native-executorch-expo-resource-fetcher'
package-json-path: 'packages/expo-resource-fetcher/package.json'
install-dependencies-command: 'yarn install --immutable && yarn workspace react-native-executorch prepare'
# See the first satellite above for why this is a focused install.
install-dependencies-command: 'yarn workspaces focus react-native-executorch-expo-resource-fetcher && yarn workspace react-native-executorch prepare'
release-type: ${{ inputs.release-type }}
version: ${{ steps.version.outputs.version }}
perform-git-operations: ${{ inputs.perform-git-operations }}
Expand All @@ -123,7 +132,8 @@ jobs:
with:
package-name: 'react-native-executorch-webrtc'
package-json-path: 'packages/react-native-executorch-webrtc/package.json'
install-dependencies-command: 'yarn install --immutable && yarn workspace react-native-executorch prepare'
# See the first satellite above for why this is a focused install.
install-dependencies-command: 'yarn workspaces focus react-native-executorch-webrtc && yarn workspace react-native-executorch prepare'
release-type: ${{ inputs.release-type }}
version: ${{ steps.version.outputs.version }}
perform-git-operations: ${{ inputs.perform-git-operations }}
Expand Down
32 changes: 25 additions & 7 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
- legacy # maintenance release of an older line
default: nightly
dist-tag:
description: 'Publish under this exact dist-tag instead, e.g. v0.8 for a maintenance line (leave empty to use release-type)'
description: 'npm dist-tag to publish under instead of the one release-type implies, e.g. v0-8 for a maintenance line. NOT the git tag. Leave empty for a normal release.'
required: false
type: string
default: ''
Expand Down Expand Up @@ -50,6 +50,13 @@ jobs:
RELEASE_TYPE: ${{ inputs.release-type || 'nightly' }}
DRY_RUN: ${{ inputs.dry-run || false }}
DIST_TAG_OVERRIDE: ${{ inputs.dist-tag || '' }}
# Nothing this job does needs the native artifacts: it runs bob and tsc,
# and the "files" list excludes third-party/include from the tarball. The
# postinstall download only cost time and printed iOS-backend warnings on
# a Linux runner.
RNET_SKIP_DOWNLOAD: 1
# create-package.sh installs too; the focused install below covers it.
RNE_SKIP_INSTALL: 1
steps:
- name: Checkout
uses: actions/checkout@v6
Expand All @@ -71,8 +78,17 @@ jobs:
if: ${{ env.EXECUTORCH_VERSION == 'PLACEHOLDER' }}
run: exit 1 # this should never happen

- name: Install monorepo dependencies
run: yarn install --immutable
# The root workspaces glob is packages/* + apps/* + apps/legacy/*, so a
# plain `yarn install` pulled 1659 packages (597 MiB) to build one of
# them: 164s of a 197s job, against 19s for the actual build. `workspaces
# focus` installs only this package's tree; it is built into Yarn 4, the
# same command family as the `workspaces foreach` already used in CI.
#
# This drops --immutable, which `focus` does not accept. The lockfile is
# already asserted immutable by the CI workflow on every pull request, and
# a release publishes from a branch that passed it.
- name: Install the core package's dependencies
run: yarn workspaces focus react-native-executorch

- name: Set tag
run: |
Expand All @@ -85,10 +101,12 @@ jobs:
echo "dist-tag override needs a stable build: set release-type to latest or legacy." >&2
exit 1
fi
# npm rejects a dist-tag that parses as a semver range, so require a
# leading letter. That also rules out bare versions like `0.8`.
if [[ ! "$DIST_TAG_OVERRIDE" =~ ^[a-zA-Z][a-zA-Z0-9._-]*$ ]]; then
echo "Invalid dist-tag: '$DIST_TAG_OVERRIDE' (expected e.g. v0.8)" >&2
# npm's rule is that a dist-tag must not parse as a semver range,
# so ask semver rather than approximate it. The previous check only
# required a leading letter, which let through every tag this input
# documented: `v0.8` parses as `>=0.8.0 <0.9.0-0`, `v0.10.0` as
# `0.10.0`. Both reached npm and failed there instead of here.
if ! node -e 'const r=require("semver").validRange(process.argv[1]); if (r) { console.error(`Invalid dist-tag: ${process.argv[1]} parses as the semver range ${r}, and npm rejects those. Use a form that is not a version, e.g. v0-8 for the 0.8 line.`); process.exit(1); }' "$DIST_TAG_OVERRIDE"; then
exit 1
fi
echo "TAG=$DIST_TAG_OVERRIDE" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion packages/bare-resource-fetcher/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"outDir": "lib",
"declaration": true,
"declarationMap": true,
"tsBuildInfoFile": "./lib/typescript/tsconfig.tsbuildinfo",
"tsBuildInfoFile": "./.cache/tsconfig.tsbuildinfo",
"composite": true,
"allowJs": false,
"allowUnreachableCode": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-resource-fetcher/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"outDir": "lib",
"declaration": true,
"declarationMap": true,
"tsBuildInfoFile": "./lib/typescript/tsconfig.tsbuildinfo",
"tsBuildInfoFile": "./.cache/tsconfig.tsbuildinfo",
"composite": true,
"allowJs": false,
"allowUnreachableCode": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-executorch-webrtc/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"outDir": "lib",
"declaration": true,
"declarationMap": true,
"tsBuildInfoFile": "./lib/typescript/tsconfig.tsbuildinfo",
"tsBuildInfoFile": "./.cache/tsconfig.tsbuildinfo",
"composite": true,
"allowJs": false,
"allowUnreachableCode": false,
Expand Down
6 changes: 5 additions & 1 deletion packages/react-native-executorch/scripts/create-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ trap cleanup EXIT
rm -rf "$PHONEMIS_DIR/data" "$PHONEMIS_DIR/test" "$PHONEMIS_DIR/scripts"
rm -f "$PHONEMIS_DIR/requirements.txt"

yarn install --immutable
# The publish workflow installs before calling this script, so it sets
# RNE_SKIP_INSTALL to avoid a second pass. A local run still installs.
if [ -z "${RNE_SKIP_INSTALL:-}" ]; then
yarn install --immutable
fi

# Match the version line by pattern, not by line number: `nativeLibsVersion`
# sits next to it, so a positional edit rewrites the wrong field if either
Expand Down