Update Get started and publish it to npm #3
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: Publish to npm | |
on: | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'examples/get-started/**' | |
# TODO: Remove after testing | |
pull_request: | |
branches: | |
- '*' | |
paths: | |
- 'examples/get-started/**' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
# Only install dev dependencies, for the binary. No need to install deps for the source code. | |
- name: Install dependencies | |
# Weird tsup quirk https://github.com/npm/cli/issues/4828#issuecomment-2404560937 | |
run: pnpm i @rollup/rollup-linux-x64-gnu && pnpm install --dev | |
working-directory: ./examples/get-started | |
- name: Build binary | |
run: pnpm run build-bin | |
working-directory: ./examples/get-started | |
- name: Publish to npm | |
run: npm publish --access public | |
working-directory: ./examples/get-started | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |