* Disallow version bump with dirty working tree (cherry picked from commit853e735edf
) * Ignore `not_paths` for `*.md` files when bumping version (cherry picked from commit510760d81b
) * Also ignore `*/node_modules/*` paths when bumping version (cherry picked from commit2bf46b789f
) Co-authored-by: Trent Nelson <trent@solana.com>
This commit is contained in:
@ -23,6 +23,7 @@ ignores=(
|
|||||||
.cargo
|
.cargo
|
||||||
target
|
target
|
||||||
web3.js/examples
|
web3.js/examples
|
||||||
|
node_modules
|
||||||
)
|
)
|
||||||
|
|
||||||
not_paths=()
|
not_paths=()
|
||||||
@ -30,10 +31,10 @@ for ignore in "${ignores[@]}"; do
|
|||||||
not_paths+=(-not -path "*/$ignore/*")
|
not_paths+=(-not -path "*/$ignore/*")
|
||||||
done
|
done
|
||||||
|
|
||||||
# shellcheck disable=2207,SC2068 # Don't want a positional arg if `not-paths` is empty
|
|
||||||
Cargo_tomls=($(find . -mindepth 2 -name Cargo.toml ${not_paths[@]}))
|
|
||||||
# shellcheck disable=2207
|
# shellcheck disable=2207
|
||||||
markdownFiles=($(find . -name "*.md"))
|
Cargo_tomls=($(find . -mindepth 2 -name Cargo.toml "${not_paths[@]}"))
|
||||||
|
# shellcheck disable=2207
|
||||||
|
markdownFiles=($(find . -name "*.md" "${not_paths[@]}"))
|
||||||
|
|
||||||
# Collect the name of all the internal crates
|
# Collect the name of all the internal crates
|
||||||
crates=()
|
crates=()
|
||||||
@ -105,6 +106,17 @@ check)
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Version bumps should occur in their own commit. Disallow bumping version
|
||||||
|
# in dirty working trees. Gate after arg parsing to prevent breaking the
|
||||||
|
# `check` subcommand.
|
||||||
|
(
|
||||||
|
set +e
|
||||||
|
if ! git diff --exit-code; then
|
||||||
|
echo -e "\nError: Working tree is dirty. Commit or discard changes before bumping version." 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
newVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"
|
newVersion="$MAJOR.$MINOR.$PATCH$SPECIAL"
|
||||||
|
|
||||||
# Update all the Cargo.toml files
|
# Update all the Cargo.toml files
|
||||||
|
Reference in New Issue
Block a user