Skip to content

chore: replace rimraf with rm -rf for pnpm compatibility #7

chore: replace rimraf with rm -rf for pnpm compatibility

chore: replace rimraf with rm -rf for pnpm compatibility #7

Workflow file for this run

name: Deploy to npm
on:
workflow_dispatch:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Pnpm
uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "pnpm"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm run lint
- name: Build
run: pnpm run build
- name: Publish to npm
run: |
VERSION=$(node -p "require('./package.json').version")
PACKAGE=$(node -p "require('./package.json').name")
OUTPUT=$(pnpm publish --provenance --access public --no-git-checks 2>&1) || {
if echo "$OUTPUT" | grep -q "cannot publish over the previously published"; then
echo "${PACKAGE}@${VERSION} already published, skipping"
exit 0
fi
echo "$OUTPUT" >&2
exit 1
}
echo "$OUTPUT"