Publish library to NPM by MonsterDeveloper #16
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: Publish library to NPM | |
run-name: Publish library to NPM by ${{ github.actor }} | |
on: | |
push: | |
branches: | |
- main | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
publish-to-npm: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
permissions: | |
contents: write | |
id-token: write | |
pull-requests: write | |
env: | |
HUSKY: 0 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: 1.1.38 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: bun i --frozen-lockfile | |
- name: Typecheck | |
run: bun typecheck | |
- name: Run Biome | |
run: bun biome ci | |
- name: Test | |
run: bun run test | |
- name: Build | |
run: bun run build | |
- name: Check exports | |
run: bun check-exports | |
- name: Create Release Pull Request or Publish to npm | |
uses: changesets/action@v1 | |
id: changesets | |
with: | |
publish: bun changeset publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |