Refresh scaffold bundle #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Refresh scaffold bundle | |
| # The @reactunity/create scaffold ships a prebuilt JS bundle under Assets/Resources/react -- | |
| # it is what a user sees on first open, before they ever run a build. Nothing regenerates it, | |
| # so it sat at React 18.2 from April 2024 while the app beside it declared React 19. | |
| # | |
| # Nightly rather than chained to a release, for the same reason release-kitchen-sink.yml is | |
| # not chained: this rebuild resolves the app's dependency ranges fresh, so it also catches | |
| # breakage that arrives from upstream -- a new React, a new TypeScript -- with no release of | |
| # ours involved. Putting a webpack build on the release path would only cover the other case. | |
| # | |
| # It opens a PR rather than committing to main like the snapshot step in unity-tests.yml. A | |
| # regenerated bundle is a 350 kB binary-shaped diff nobody reads, and the whole reason it | |
| # needs regenerating is that a stale one is invisible -- so the change should be looked at. | |
| # | |
| # ProjectVersion.txt is deliberately NOT touched here. Unity performs an Editor upgrade by | |
| # opening the project; writing the version string alone would label the project upgraded | |
| # without re-serializing anything. The script reports the drift and a human does it. | |
| on: | |
| schedule: | |
| # 04:00 UTC, clear of the release workflow, which runs on push to main. | |
| - cron: '0 4 * * *' | |
| workflow_dispatch: | |
| concurrency: | |
| group: refresh-scaffold | |
| cancel-in-progress: false | |
| jobs: | |
| refresh: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # push the branch the PR is opened from | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version-file: .node-version | |
| cache: pnpm | |
| # For tsx, which the root .npmrc wires in as --import so the .mts script is runnable. | |
| # The scaffold app itself is NOT a workspace member and installs its own deps, inside | |
| # a temp copy, as part of the script. | |
| - run: pnpm install --frozen-lockfile | |
| # Fails if the build stops emitting exactly the asset set the scaffold has .meta files | |
| # for -- a sourcemap or a hashed chunk would otherwise reach a user's project unimported. | |
| - name: Rebuild the bundle | |
| run: node scripts/create/refresh-scaffold.mts | |
| - name: Open a pull request | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| branch: chore/refresh-scaffold-bundle | |
| # Reused rather than a new branch per run: the bundle is regenerated wholesale every | |
| # night, so an open PR is never partly superseded -- force-pushing it just makes it | |
| # current. A branch per night would leave a queue of stale 350 kB diffs. | |
| base: main | |
| title: 'chore: refresh the create scaffold bundle' | |
| commit-message: 'chore: refresh the create scaffold bundle' | |
| labels: dependencies | |
| add-paths: packages/create/scaffold/Assets/Resources/react | |
| body: | | |
| Regenerated by `scripts/create/refresh-scaffold.mts` from `packages/create/scaffold/react`. | |
| This is the bundle a scaffolded project renders on first open, before the user runs | |
| a build. The rebuild resolves the app's dependency ranges fresh, so a diff here can | |
| mean either a ReactUnity release or an upstream bump. | |
| Worth a glance at what moved rather than a blind merge — a bundle that fails to | |
| render is invisible until someone scaffolds a project and opens it. |