rust-toolchain/scripts/update-revs.sh
2022-06-16 20:35:44 -07:00

46 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
if ! git diff-index --quiet HEAD; then
echo "Not running update-revs.sh because git working directory is dirty" >&2
exit 1
fi
patch_releases=(
1.12.1 1.15.1 1.22.1 1.24.1 1.26.1 1.26.2 1.27.1 1.27.2 1.29.1 1.29.2 1.30.1
1.31.1 1.34.1 1.34.2 1.41.1 1.43.1 1.44.1 1.45.1 1.45.2 1.52.1 1.56.1 1.58.1
)
releases() {
printf "%s\n" 1.{0..70}.0 ${patch_release[@]} | sort -V
}
base=$(git rev-parse HEAD)
push=()
for rev in `releases` stable beta nightly; do
echo "Updating $rev branch"
git checkout --quiet "$base"
git branch --quiet --delete --force $rev &>/dev/null || true
sed -i "s/required: true/required: false\n default: $rev/" action.yml
git add action.yml
git commit --quiet --message "toolchain: $rev"
git checkout --quiet -b $rev
push+=("$rev:refs/heads/$rev")
done
for tool in clippy miri; do
echo "Updating $tool branch"
git checkout --quiet --detach nightly
git branch --quiet --delete --force $tool &>/dev/null || true
sed -i "/required: false/{N;s/\n$/\n default: $tool\n/}" action.yml
git add action.yml
git commit --quiet --message "components: $tool"
git checkout --quiet -b $tool
push+=("$tool:refs/heads/$tool")
done
git checkout --quiet "$base"
echo "git push origin --force-with-lease ${push[@]}"