Skip to content

Commit

Permalink
fix: getting correct status from npm publish/view
Browse files Browse the repository at this point in the history
Closes #417
  • Loading branch information
lukekarrys committed Apr 25, 2024
1 parent df03d8b commit f2f3ca3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 46 deletions.
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

0 comments on commit f2f3ca3

Please sign in to comment.