Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add filename to parser exception message. Add script which checks for that everything is in order for new tags. closes #50
- Loading branch information
Showing
6 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
# set -o xtrace | ||
|
||
declare -r __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
||
# shellcheck source=$HOME/dotfiles/scripts/helpers | ||
source "${HOME}/dotfiles/scripts/helpers" | ||
|
||
function main() { | ||
readonly TAG="${1:-}" | ||
if [[ $TAG = "" || ! $TAG =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}$ ]]; then | ||
_error "Please provide the git tag (e.g. 2.31.2) as the first argument." | ||
exit 1 | ||
fi | ||
|
||
if git show "${TAG}" >/dev/null 2>&1; then | ||
_error "Tag already exists." | ||
exit 2 | ||
fi | ||
|
||
if [[ $(grep -cF "${TAG}" "${__dir}/../README.md") != 1 ]]; then | ||
_error "${TAG} not found in README.md." | ||
exit 3 | ||
fi | ||
|
||
if [[ $(grep -cF "${TAG}" "${__dir}/../bin/dephpend") != 1 ]]; then | ||
_error "${TAG} not found in binary." | ||
exit 4 | ||
fi | ||
|
||
if [[ $(grep -cF "${TAG}" "${__dir}/../CHANGELOG.md") != 3 ]]; then | ||
_error "${TAG} not mentioned or linked in CHANGELOG.md." | ||
exit 5 | ||
fi | ||
|
||
git tag -a "${TAG}" -m "${TAG}" | ||
readonly EXIT_CODE="$?" | ||
[[ $EXIT_CODE = 0 ]] && _success "Git tag successfully created." || _error "Command 'git tag failed'." | ||
exit "${EXIT_CODE}" | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters