Skip to content

Commit

Permalink
Bundle to both ESM and CJS
Browse files Browse the repository at this point in the history
This also adds full CI/CD automation
for easier publish process.
  • Loading branch information
blomqma committed Jan 9, 2024
1 parent e97bb88 commit a898011
Show file tree
Hide file tree
Showing 37 changed files with 4,155 additions and 2,971 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ name: "CI"

on:
push:
branches: [main]
pull_request:
branches:
- "**"

jobs:
build:
name: "Run CI pipeline"
runs-on: ubuntu-latest
strategy:
matrix:
node: [18]
node: [18, 20]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: pnpm/action-setup@v2
with:
version: 7.5.1
version: 7
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: "pnpm"
- run: pnpm i
- run: pnpm i --frozen-lockfile
- run: pnpm run ci

- name: Coverage
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Publish"

on:
workflow_run:
workflows: [CI]
branches: [main]
types: [completed]

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: 20.x
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading

0 comments on commit a898011

Please sign in to comment.