Workflow file for this run
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 Package to NPM | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: | | |
| # Apply workaround for npm optional dependencies bug with Rollup | |
| echo "Applying workaround for Rollup optional dependencies issue" | |
| rm -rf node_modules package-lock.json | |
| npm install --ignore-scripts | |
| # Verify Rollup binary is available | |
| if ! npm list @rollup/rollup-linux-x64-gnu >/dev/null 2>&1; then | |
| echo "Installing Rollup Linux binary explicitly" | |
| npm install @rollup/rollup-linux-x64-gnu --no-save || echo "Manual Rollup install failed" | |
| fi | |
| - name: Run tests (if any) | |
| continue-on-error: true | |
| run: npm test --if-present | |
| - name: Build package | |
| run: npm run build | |
| - name: Verify package contents | |
| run: npm pack --dry-run | |
| - name: Publish to NPM | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |