Skip to content

fix prepublish script & add publish workflow #1

fix prepublish script & add publish workflow

fix prepublish script & add publish workflow #1

Workflow file for this run

name: Test and Publish
on:
push:
branches:
- main
jobs:
test-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Run tests
run: |
bun test || exit 1
- name: Prepare for publish
run: bun run prepublishOnly
- name: Publish to npm
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}