Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get correct exit code from npm publish/view #436

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .github/workflows/release-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,10 @@ jobs:
run: |
EXIT_CODE=0

function each_release {
if npm publish --provenance --tag="$1"; then
echo 0
else
echo 1
fi
}

for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag)
STATUS=$(each_release "$PUBLISH_TAG")
npm publish --provenance --tag="$PUBLISH_TAG"
STATUS=$?
if [[ "$STATUS" -eq 1 ]]; then
EXIT_CODE=$STATUS
fi
Expand Down
13 changes: 3 additions & 10 deletions lib/content/_job-release-integration-yml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,15 @@ steps:
run: |
EXIT_CODE=0

function each_release {
if {{#if publish}}npm publish --provenance --tag="$1"{{else}}npm view "$@" --loglevel=error > /dev/null{{/if}}; then
echo 0
else
echo 1
fi
}

for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
{{#if publish}}
PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag)
STATUS=$(each_release "$PUBLISH_TAG")
npm publish --provenance --tag="$PUBLISH_TAG"
{{else}}
SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)"
STATUS=$(each_release "$SPEC")
npm view "$SPEC" --json
{{/if}}
STATUS=$?
if [[ "$STATUS" -eq 1 ]]; then
EXIT_CODE=$STATUS
{{#unless publish}}
Expand Down
33 changes: 6 additions & 27 deletions tap-snapshots/test/apply/source-snapshots.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -889,17 +889,10 @@ jobs:
run: |
EXIT_CODE=0

function each_release {
if npm view "$@" --loglevel=error > /dev/null; then
echo 0
else
echo 1
fi
}

for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)"
STATUS=$(each_release "$SPEC")
npm view "$SPEC" --json
STATUS=$?
if [[ "$STATUS" -eq 1 ]]; then
EXIT_CODE=$STATUS
echo "$SPEC ERROR"
Expand Down Expand Up @@ -2526,17 +2519,10 @@ jobs:
run: |
EXIT_CODE=0

function each_release {
if npm view "$@" --loglevel=error > /dev/null; then
echo 0
else
echo 1
fi
}

for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)"
STATUS=$(each_release "$SPEC")
npm view "$SPEC" --json
STATUS=$?
if [[ "$STATUS" -eq 1 ]]; then
EXIT_CODE=$STATUS
echo "$SPEC ERROR"
Expand Down Expand Up @@ -4035,17 +4021,10 @@ jobs:
run: |
EXIT_CODE=0

function each_release {
if npm view "$@" --loglevel=error > /dev/null; then
echo 0
else
echo 1
fi
}

for release in $(echo $RELEASES | jq -r '.[] | @base64'); do
SPEC="$(echo "$release" | base64 --decode | jq -r .pkgName)@$(echo "$release" | base64 --decode | jq -r .version)"
STATUS=$(each_release "$SPEC")
npm view "$SPEC" --json
STATUS=$?
if [[ "$STATUS" -eq 1 ]]; then
EXIT_CODE=$STATUS
echo "$SPEC ERROR"
Expand Down
Loading