A legged function chains with && : the || that captures the status suspends set -e
This commit is contained in:
+12
-13
@@ -3,23 +3,22 @@ set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
source ./docker-runner.sh
|
||||
|
||||
read_field() {
|
||||
in_image "$node_image" npm pkg get "$1" | tr -d '"\r'
|
||||
}
|
||||
|
||||
read_package_fields() {
|
||||
private=$(read_field private)
|
||||
name=$(read_field name)
|
||||
version=$(read_field version)
|
||||
}
|
||||
|
||||
published_version() {
|
||||
in_image "$node_image" npm view "$1@$2" version 2>/dev/null || true
|
||||
}
|
||||
|
||||
push_tag() {
|
||||
git tag "v$version"
|
||||
git push origin "v$version"
|
||||
git tag "v$version" && git push origin "v$version"
|
||||
}
|
||||
|
||||
read_field() {
|
||||
in_image "$node_image" npm pkg get "$1" | tr -d '"\r'
|
||||
}
|
||||
|
||||
read_package_fields() {
|
||||
private=$(read_field private) &&
|
||||
name=$(read_field name) &&
|
||||
version=$(read_field version)
|
||||
}
|
||||
|
||||
leg "read package.json ($node_image)" read_package_fields
|
||||
@@ -28,7 +27,7 @@ if [ "$private" = 'true' ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
published=$(leg "ask npmjs for $name@$version" published_version "$name" "$version")
|
||||
published=$(leg "ask npmjs for $name@$version ($node_image)" published_version "$name" "$version")
|
||||
tagged=$(leg "ask origin for v$version" git ls-remote --tags origin "v$version")
|
||||
|
||||
# Both steps observe their own end state, so a partial run converges on the next push to main.
|
||||
|
||||
Reference in New Issue
Block a user