Skip to content

Commit d0ad6b3

Browse files
author
Maxim Titovich
committed
Fix: Improve publish workflow to trigger on all relevant commits to main
1 parent d8f963b commit d0ad6b3

File tree

2 files changed

+35
-9
lines changed

2 files changed

+35
-9
lines changed

.github/workflows/publish.yml

+32-6
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ name: Publish to npm
33
on:
44
push:
55
branches: [ "main" ]
6-
# Only trigger when package.json changes or when a release tag is created
7-
paths:
8-
- 'package.json'
9-
- 'src/**'
10-
- 'build/**'
6+
# Exclude paths that shouldn't trigger a build/release
7+
paths-ignore:
8+
- '**.md'
9+
- '.github/**'
10+
- '.vscode/**'
11+
- '.gitignore'
12+
- 'LICENSE'
13+
- 'docs/**'
1114
release:
1215
types: [created]
1316
workflow_dispatch:
@@ -92,6 +95,15 @@ jobs:
9295
echo "version=${{ steps.extract_version.outputs.version }}" >> $GITHUB_OUTPUT
9396
echo "Using original version: ${{ steps.extract_version.outputs.version }}"
9497
fi
98+
99+
# Debug event info
100+
echo "==== Debug Information ===="
101+
echo "Event name: ${{ github.event_name }}"
102+
echo "Current version: ${{ steps.extract_version.outputs.version }}"
103+
echo "Version exists: ${{ steps.version_check.outputs.exists }}"
104+
echo "Auto-bump triggered: ${{ steps.auto_bump.outputs.new_version != '' }}"
105+
echo "Final version for publishing: ${{ steps.final_version.outputs.version }}"
106+
echo "==========================="
95107
96108
# Push changes if version was bumped
97109
- name: Push changes if version was bumped
@@ -112,11 +124,25 @@ jobs:
112124
generate_release_notes: true
113125
env:
114126
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127+
128+
# Debug publishing conditions
129+
- name: Debug publishing conditions
130+
run: |
131+
echo "==== Publishing Conditions ===="
132+
echo "Version doesn't exist: ${{ steps.version_check.outputs.exists == 'false' }}"
133+
echo "Auto-bumped version: ${{ steps.auto_bump.outputs.new_version != '' }}"
134+
echo "Should publish: ${{ (steps.version_check.outputs.exists == 'false') || (steps.auto_bump.outputs.new_version != '') }}"
135+
echo "==============================="
115136
137+
# Publish to npm if:
138+
# 1. The version doesn't exist on npm, OR
139+
# 2. We auto-bumped to a new version
116140
- name: Publish to npm
117141
if: |
118142
(steps.version_check.outputs.exists == 'false') ||
119143
(steps.auto_bump.outputs.new_version != '')
120-
run: npm publish
144+
run: |
145+
echo "Publishing version ${{ steps.final_version.outputs.version }} to npm"
146+
npm publish
121147
env:
122148
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ You can see the workflow details in `.github/workflows/ci.yml`.
344344
### CD Workflow (Publishing)
345345

346346
The publishing workflow runs when:
347-
- A change is pushed to the main branch that modifies `package.json` or source code
347+
- Any change is pushed to the main branch (except documentation & config files)
348348
- A new GitHub release is created
349349
- Manually triggered via GitHub Actions interface
350350

@@ -359,11 +359,11 @@ It performs the following steps:
359359
To use this workflow, you need to:
360360
1. Add an `NPM_TOKEN` secret to your GitHub repository settings
361361
2. Either:
362-
- Push changes to the main branch (auto-versioning will handle the rest)
362+
- Push code changes to the main branch (auto-versioning will handle the rest)
363363
- Manually trigger the workflow from the Actions tab
364364
- Create a GitHub release
365365

366-
The workflow supports automatic version bumping when a version conflict is detected, making continuous delivery seamless.
366+
The workflow supports automatic version bumping when a version conflict is detected, making continuous delivery seamless without manual version management.
367367

368368
You can see the workflow details in `.github/workflows/publish.yml`.
369369

0 commit comments

Comments
 (0)