Skip to content

Commit

Permalink
tools: Update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Apr 20, 2024
1 parent b0b777d commit 0d0be15
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
31 changes: 19 additions & 12 deletions tools/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ trap 's=$?; echo >&2 "$0: error on line "${LINENO}": ${BASH_COMMAND}"; exit ${s}
# Note: This script requires the following tools:
# - parse-changelog <https://github.com/taiki-e/parse-changelog>

x() {
local cmd="$1"
shift
(
set -x
"${cmd}" "$@"
)
retry() {
for i in {1..10}; do
if "$@"; then
return 0
else
sleep "${i}"
fi
done
"$@"
}
bail() {
echo >&2 "error: $*"
Expand Down Expand Up @@ -178,10 +180,15 @@ done

if [[ -n "${tags}" ]]; then
# Create a release commit.
x git add "${changed_paths[@]}"
x git commit -m "Release ${version}"
(
set -x
git add "${changed_paths[@]}"
git commit -m "Release ${version}"
)
fi

x git tag "${tag}"
x git push origin main
x git push origin --tags
set -x

git tag "${tag}"
retry git push origin main
retry git push origin --tags
2 changes: 1 addition & 1 deletion tools/tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if [[ -n "$(git ls-files '*.rs')" ]]; then
# `cargo fmt` cannot recognize files not included in the current workspace and modules
# defined inside macros, so run rustfmt directly.
# We need to use nightly rustfmt because we use the unstable formatting options of rustfmt.
rustc_version=$(rustc -Vv | grep 'release: ' | sed 's/release: //')
rustc_version=$(rustc -vV | grep 'release: ' | sed 's/release: //')
if [[ "${rustc_version}" == *"nightly"* ]] || [[ "${rustc_version}" == *"dev"* ]]; then
rustup component add rustfmt &>/dev/null
echo "+ rustfmt \$(git ls-files '*.rs')"
Expand Down

0 comments on commit 0d0be15

Please sign in to comment.