Skip to content

Commit 1a517a1

Browse files
Copilotfengmk2
andcommitted
Fix release workflow to use prerelease_tag for npm publish
Co-authored-by: fengmk2 <156269+fengmk2@users.noreply.github.com>
1 parent 4a669b2 commit 1a517a1

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,25 @@ jobs:
112112
if: ${{ github.event.inputs.dry_run == 'true' }}
113113
run: |
114114
echo "🧪 Running publish in dry-run mode..."
115-
pnpm -r publish --dry-run --no-git-checks
115+
if [[ "${{ github.event.inputs.version_type }}" == pre* ]]; then
116+
echo "Setting npm tag to: ${{ github.event.inputs.prerelease_tag }}"
117+
pnpm -r publish --dry-run --no-git-checks --tag=${{ github.event.inputs.prerelease_tag }}
118+
else
119+
echo "Setting npm tag to: latest"
120+
pnpm -r publish --dry-run --no-git-checks --tag=latest
121+
fi
116122
117123
- name: Publish packages
118124
if: ${{ github.event.inputs.dry_run != 'true' }}
119125
run: |
120126
echo "📦 Publishing packages..."
121-
pnpm -r publish --no-git-checks
127+
if [[ "${{ github.event.inputs.version_type }}" == pre* ]]; then
128+
echo "Setting npm tag to: ${{ github.event.inputs.prerelease_tag }}"
129+
pnpm -r publish --no-git-checks --tag=${{ github.event.inputs.prerelease_tag }}
130+
else
131+
echo "Setting npm tag to: latest"
132+
pnpm -r publish --no-git-checks --tag=latest
133+
fi
122134
123135
- name: Create GitHub Release (draft)
124136
if: ${{ github.event.inputs.dry_run != 'true' }}
@@ -159,7 +171,7 @@ jobs:
159171
name: tag,
160172
body: releaseBody,
161173
draft: true,
162-
prerelease: false
174+
prerelease: versionType.includes('pre')
163175
});
164176
165177
core.info(`Created draft release: ${release.data.html_url}`);
@@ -172,12 +184,22 @@ jobs:
172184
echo "### 🧪 Dry Run Completed" >> $GITHUB_STEP_SUMMARY
173185
echo "- Version bump: **${{ github.event.inputs.version_type }}**" >> $GITHUB_STEP_SUMMARY
174186
echo "- Branch: **${{ github.event.inputs.branch }}**" >> $GITHUB_STEP_SUMMARY
187+
if [[ "${{ github.event.inputs.version_type }}" == pre* ]]; then
188+
echo "- npm tag: **${{ github.event.inputs.prerelease_tag }}**" >> $GITHUB_STEP_SUMMARY
189+
else
190+
echo "- npm tag: **latest**" >> $GITHUB_STEP_SUMMARY
191+
fi
175192
echo "- Status: **Dry run - no changes made**" >> $GITHUB_STEP_SUMMARY
176193
else
177194
echo "### ✅ Release Completed" >> $GITHUB_STEP_SUMMARY
178195
echo "- Version bump: **${{ github.event.inputs.version_type }}**" >> $GITHUB_STEP_SUMMARY
179196
echo "- Branch: **${{ github.event.inputs.branch }}**" >> $GITHUB_STEP_SUMMARY
180197
echo "- New tag: **$NEW_TAG**" >> $GITHUB_STEP_SUMMARY
198+
if [[ "${{ github.event.inputs.version_type }}" == pre* ]]; then
199+
echo "- npm tag: **${{ github.event.inputs.prerelease_tag }}**" >> $GITHUB_STEP_SUMMARY
200+
else
201+
echo "- npm tag: **latest**" >> $GITHUB_STEP_SUMMARY
202+
fi
181203
echo "- Packages published to npm" >> $GITHUB_STEP_SUMMARY
182204
echo "- Draft GitHub release created" >> $GITHUB_STEP_SUMMARY
183205
fi

0 commit comments

Comments
 (0)