Skip to content

Commit faf35aa

Browse files
fix: fail workflow when npm publish fails
1 parent ffacf79 commit faf35aa

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,24 @@ jobs:
142142

143143
- name: Publish platform packages
144144
run: |
145+
failed=0
145146
for pkg in packages/ansilust-*/; do
146147
if [ -f "$pkg/package.json" ]; then
147148
echo "Publishing $pkg..."
148149
cd "$pkg"
149-
npm publish --provenance --access public || echo "Failed to publish $pkg (may already exist)"
150+
if ! npm publish --provenance --access public; then
151+
echo "::error::Failed to publish $pkg"
152+
failed=1
153+
fi
150154
cd - > /dev/null
151155
fi
152156
done
157+
if [ "$failed" -eq 1 ]; then
158+
exit 1
159+
fi
153160
154161
- name: Publish meta package
155-
run: npm publish packages/ansilust/ --provenance --access public || echo "Failed to publish meta package (may already exist)"
162+
run: npm publish packages/ansilust/ --provenance --access public
156163

157164
create-release:
158165
name: Create GitHub release

0 commit comments

Comments
 (0)