Compile react/ subpath for dist publishing
#4
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm build | |
| build-site: | |
| needs: build-and-test | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: cd site && pnpm build | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: site/dist | |
| deploy-site: | |
| needs: build-site | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 | |
| build-dist: | |
| needs: build-and-test | |
| if: github.ref == 'refs/heads/main' | |
| uses: runsascoded/npm-dist/.github/workflows/build-dist.yml@v1 | |
| with: | |
| # Vite emits a multi-entry build: dist/{index,react/index}.{js,d.ts}. | |
| # Default mode (no preserve_dirs) flattens dist/* to the dist branch root. | |
| exports_map: | | |
| { | |
| "./src/index.ts": {"types": "./index.d.ts", "import": "./index.js"}, | |
| "./react/index.ts": {"types": "./react/index.d.ts", "import": "./react/index.js"} | |
| } | |
| pkg_kvs: | | |
| { | |
| "main": "./index.js", | |
| "module": "./index.js", | |
| "types": "./index.d.ts" | |
| } |