Skip to content

Fix Prettier dependency issue in GitHub Actions workflow #34

Fix Prettier dependency issue in GitHub Actions workflow

Fix Prettier dependency issue in GitHub Actions workflow #34

Workflow file for this run

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: |
# First try npm ci, if it fails due to optional dependencies, use workaround
npm ci --ignore-scripts || {
echo "npm ci failed, applying workaround for optional dependencies bug"
rm -rf node_modules package-lock.json
npm install --ignore-scripts
}
- 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 }}