Skip to content

Commit

Permalink
Add check if patch applies into release script
Browse files Browse the repository at this point in the history
  • Loading branch information
meeDamian committed Mar 8, 2020
1 parent 7e9d126 commit 5f5e33d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts/new-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@ fi
DIR="$(echo "$VERSION" | tr -d v | cut -d. -f-2)"

# If variant is provided, verify it exists
if [[ -n "$VARIANT" ]] && [[ ! -f "$DIR/variant-$VARIANT.patch" ]]; then
>&2 printf "\nERR: missing variant: variant passed as the 2nd argument, but corresponding patch file is not present. Try:\n"
>&2 printf "\t./%s %s %s\n\n" "$(basename "$0")" "v0.8.1" "monitoring"
exit 1
if [[ -n "$VARIANT" ]]; then
if [[ ! -f "$DIR/variant-$VARIANT.patch" ]]; then
>&2 printf "\nERR: variant missing: variant passed as the 2nd argument, but corresponding patch file is not present.\n"
>&2 printf "\tMake sure that './%s/variant-%s.patch' file exists.\n\n" "$DIR" "$VARIANT"
exit 1
fi

if ! patch --dry-run --quiet -d "$DIR" < "$DIR/variant-$VARIANT.patch"; then
>&2 printf "\nERR: variant broken: specified variant: '%s' does not apply cleanly\n" "$VARIANT"
>&2 printf "\tFix the errors, and run this command again.\n\n"
exit 1
fi
fi

# Verify there's no uncommitted changes in the working dir
Expand Down

0 comments on commit 5f5e33d

Please sign in to comment.