chore: remove prepare script (conflicts with pnpm install) #6
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: 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" |