fix: fully cjs/esm dual pacakges (#222) #55
This file contains 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 | |
env: | |
CI: true | |
on: | |
push: | |
branches: | |
- next | |
pull_request: | |
branches: | |
- next | |
jobs: | |
lint: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node-version: [18] | |
os: [ubuntu-latest] | |
name: Lint on Node.js ${{ matrix.node-version }} | |
steps: | |
- name: Checkout codes | |
uses: actions/checkout@v4 | |
- name: Enable corepack | |
run: corepack enable | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Linting | |
run: pnpm lint | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node-version: [18] | |
os: [ubuntu-latest] | |
name: Build on Node.js ${{ matrix.node-version }} | |
steps: | |
- name: Checkout codes | |
uses: actions/checkout@v4 | |
- name: Enable corepack | |
run: corepack enable | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Building | |
run: pnpm build | |
test: | |
needs: | |
- build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node-version: [18, 20, 22] | |
os: [ubuntu-latest] | |
name: Test on Node.js ${{ matrix.node-version }} | |
steps: | |
- name: Checkout codes | |
uses: actions/checkout@v4 | |
- name: Enable corepack | |
run: corepack enable | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62 | |
# Install playwright's binary under custom directory to cache | |
- name: Set Playwright path | |
run: echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >> $GITHUB_ENV | |
- name: Cache Playwright's binary | |
uses: actions/cache@v4 | |
with: | |
# Playwright removes unused browsers automatically | |
# So does not need to add playwright version to key | |
key: ${{ runner.os }}-playwright-bin-v1 | |
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} | |
- name: Install Playwright | |
# does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved | |
run: pnpm playwright install chromium | |
- name: Building | |
run: pnpm build | |
- name: Testing | |
run: pnpm test | |
nightly-release: | |
needs: | |
- lint | |
- build | |
- test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node-version: [18] | |
os: [ubuntu-latest] | |
name: Nightly release | |
steps: | |
- name: Checkout codes | |
uses: actions/checkout@v4 | |
- name: Enable corepack | |
run: corepack enable | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Building | |
run: pnpm build:nightly | |
- name: Release Nightly | |
if: | | |
github.event_name == 'push' && | |
!startsWith(github.event.head_commit.message, '[skip-release]') && | |
!startsWith(github.event.head_commit.message, 'chore') && | |
!startsWith(github.event.head_commit.message, 'release') && | |
!startsWith(github.event.head_commit.message, 'docs') | |
run: ./scripts/release.sh | |
env: | |
NPM_TOKEN: ${{secrets.NPM_ORG_TOKEN}} | |
NIGHTLY_RELEASE: 'true' |