Skip to content

Commit 6d54cbf

Browse files
authored
fix: get correct exit code from npm publish/view (#436)
Closes #417
1 parent d0bf7c2 commit 6d54cbf

File tree

3 files changed

+11
-46
lines changed

3 files changed

+11
-46
lines changed

.github/workflows/release-integration.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,10 @@ jobs:
5858
run: |
5959
EXIT_CODE=0
6060
61-
function each_release {
62-
if npm publish --provenance --tag="$1"; then
63-
echo 0
64-
else
65-
echo 1
66-
fi
67-
}
68-
6961
for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
7062
PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag)
71-
STATUS=$(each_release "$PUBLISH_TAG")
63+
npm publish --provenance --tag="$PUBLISH_TAG"
64+
STATUS=$?
7265
if [[ "$STATUS" -eq 1 ]]; then
7366
EXIT_CODE=$STATUS
7467
fi

lib/content/_job-release-integration-yml.hbs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,15 @@ steps:
2323
run: |
2424
EXIT_CODE=0
2525

26-
function each_release {
27-
if {{#if publish}}npm publish --provenance --tag="$1"{{else}}npm view "$@" --loglevel=error > /dev/null{{/if}}; then
28-
echo 0
29-
else
30-
echo 1
31-
fi
32-
}
33-
3426
for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
3527
{{#if publish}}
3628
PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag)
37-
STATUS=$(each_release "$PUBLISH_TAG")
29+
npm publish --provenance --tag="$PUBLISH_TAG"
3830
{{else}}
3931
SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)"
40-
STATUS=$(each_release "$SPEC")
32+
npm view "$SPEC" --json
4133
{{/if}}
34+
STATUS=$?
4235
if [[ "$STATUS" -eq 1 ]]; then
4336
EXIT_CODE=$STATUS
4437
{{#unless publish}}

tap-snapshots/test/apply/source-snapshots.js.test.cjs

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -889,17 +889,10 @@ jobs:
889889
run: |
890890
EXIT_CODE=0
891891
892-
function each_release {
893-
if npm view "$@" --loglevel=error > /dev/null; then
894-
echo 0
895-
else
896-
echo 1
897-
fi
898-
}
899-
900892
for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
901893
SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)"
902-
STATUS=$(each_release "$SPEC")
894+
npm view "$SPEC" --json
895+
STATUS=$?
903896
if [[ "$STATUS" -eq 1 ]]; then
904897
EXIT_CODE=$STATUS
905898
echo "$SPEC ERROR"
@@ -2526,17 +2519,10 @@ jobs:
25262519
run: |
25272520
EXIT_CODE=0
25282521
2529-
function each_release {
2530-
if npm view "$@" --loglevel=error > /dev/null; then
2531-
echo 0
2532-
else
2533-
echo 1
2534-
fi
2535-
}
2536-
25372522
for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
25382523
SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)"
2539-
STATUS=$(each_release "$SPEC")
2524+
npm view "$SPEC" --json
2525+
STATUS=$?
25402526
if [[ "$STATUS" -eq 1 ]]; then
25412527
EXIT_CODE=$STATUS
25422528
echo "$SPEC ERROR"
@@ -4035,17 +4021,10 @@ jobs:
40354021
run: |
40364022
EXIT_CODE=0
40374023
4038-
function each_release {
4039-
if npm view "$@" --loglevel=error > /dev/null; then
4040-
echo 0
4041-
else
4042-
echo 1
4043-
fi
4044-
}
4045-
40464024
for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
40474025
SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)"
4048-
STATUS=$(each_release "$SPEC")
4026+
npm view "$SPEC" --json
4027+
STATUS=$?
40494028
if [[ "$STATUS" -eq 1 ]]; then
40504029
EXIT_CODE=$STATUS
40514030
echo "$SPEC ERROR"

0 commit comments

Comments
 (0)