Skip to content
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
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@ jobs:
npm pack --ignore-scripts --pack-destination out
TGZ="out/convertapi-js-$VERSION.tgz"
test -f "$TGZ"
# The listing goes to a file first. Piped into grep -q, tar can still be writing when grep exits
# at its first match; tar then fails ("stdout: write error") and pipefail reports a missing file.
tar -tzf "$TGZ" > "$RUNNER_TEMP/tgz-files.txt"
for f in dist/convertapi.js dist/convertapi.d.ts; do
tar -tzf "$TGZ" | grep -qx "package/$f" || { echo "::error::$TGZ has no $f"; exit 1; }
grep -qx "package/$f" "$RUNNER_TEMP/tgz-files.txt" || { echo "::error::$TGZ has no $f"; exit 1; }
done
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,11 @@ jobs:
test -f "$TGZ"
PKG_JSON=$(tar -xzOf "$TGZ" package/package.json)
[ "$(jq -r .version <<<"$PKG_JSON")" = "$VERSION" ] || { echo "::error::$TGZ does not carry version $VERSION"; exit 1; }
# The listing goes to a file first. Piped into grep -q, tar can still be writing when grep exits
# at its first match; tar then fails ("stdout: write error") and pipefail reports a missing file.
tar -tzf "$TGZ" > "$RUNNER_TEMP/tgz-files.txt"
for f in dist/convertapi.js dist/convertapi.d.ts; do
tar -tzf "$TGZ" | grep -qx "package/$f" || { echo "::error::$TGZ has no $f"; exit 1; }
grep -qx "package/$f" "$RUNNER_TEMP/tgz-files.txt" || { echo "::error::$TGZ has no $f"; exit 1; }
done
tar -tzf "$TGZ"

Expand Down
Loading