Remove comments #24
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 package to NPM | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
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: Build package | |
run: bun run build | |
- name: Setup .npmrc | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
- name: Publish package | |
run: | | |
if ! command -v bunx &> /dev/null; then | |
echo "bunx could not be found. Installing npm globally as a fallback." | |
curl -fsSL https://bun.sh/install | bash | |
export PATH="$HOME/.bun/bin:$PATH" | |
bunx --bun install -g npm | |
fi | |
if bunx --bun --trust pnpm publish; then | |
echo "Published using bunx pnpm." | |
elif pnpm publish; then | |
echo "Published using globally installed pnpm." | |
else | |
echo "Publish failed." | |
exit 1 | |
fi |