2025-11-24 [2] #1
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 Template to npm | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "package.json" | |
| - "src/**" | |
| - "App.tsx" | |
| jobs: | |
| publish: | |
| name: Publish to npm | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| registry-url: https://registry.npmjs.org/ | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Auto bump version | |
| if: "! contains(github.event.head_commit.message, '[skip publish]')" | |
| run: | | |
| npm version patch --no-git-tag-version | |
| git add package.json | |
| git commit -m "ci: auto bump patch version [skip ci]" || echo "No version bump needed" | |
| git push || echo "No changes to push" | |
| - name: Publish to npm | |
| if: "! contains(github.event.head_commit.message, '[skip publish]')" | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| echo "📦 Attempting to publish..." | |
| npm publish --access public || { | |
| echo "⚠️ Publish failed — skipping gracefully (likely 24h lock or duplicate version)." | |
| exit 0 | |
| } | |
| - name: Done | |
| run: echo "✔ Workflow completed" |