2021-04-10 12:44:11 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
app="watchexec"
|
|
|
|
mainbranch="main"
|
|
|
|
upstream_rx="watchexec/"
|
|
|
|
|
|
|
|
curbranch=$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
if [[ "$curbranch" != "$mainbranch" ]]; then
|
|
|
|
echo "Current branch is not $mainbranch, abort!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
gitstatus=$(git status --untracked-files=no --porcelain)
|
|
|
|
if [[ ! -z "$gitstatus" ]]; then
|
|
|
|
echo "Uncommited files and changes, abort!"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
upstream=$(git remote -v | grep -i "$upstream_rx" -m1 | awk '{print $1}')
|
|
|
|
echo "Upstream remote discovered as: $upstream"
|
|
|
|
|
|
|
|
echo "Pulling from upstream"
|
|
|
|
git pull --rebase --autostash $upstream $mainbranch
|
|
|
|
|
|
|
|
echo "Fetching tags from upstream"
|
|
|
|
git fetch --tags "$upstream"
|
|
|
|
|
2021-04-30 17:27:17 +02:00
|
|
|
extver=$(grep -P '^version =' cli/Cargo.toml | head -n1 | cut -d'"' -f2)
|
|
|
|
echo "(Version from cli/Cargo.toml: $extver)"
|
2021-04-10 12:44:11 +02:00
|
|
|
|
|
|
|
newver="$1"
|
|
|
|
|
|
|
|
if [[ "$newver" == "$extver" ]]; then
|
|
|
|
echo "New and existing versions are the same, abort!"
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
|
|
|
date=$(date +%Y-%m-%d)
|
|
|
|
echo "Next version to be $newver ($date), creating..."
|
|
|
|
|
2021-04-30 17:27:17 +02:00
|
|
|
sed -E -i "s/version=\"$extver.0\"/version=\"$newver.0\"/1" cli/watchexec.exe.manifest
|
2021-05-10 13:10:55 +02:00
|
|
|
sed -E -i "s/watchexec(.exe)? $extver/watchexec\1 $newver/" cli/tests/snapshots/help__*
|
2021-04-30 17:27:17 +02:00
|
|
|
sed -E -i "s/^version = \"$extver\"/version = \"$newver\"/1" cli/Cargo.toml
|
2022-01-23 09:54:32 +01:00
|
|
|
sed -E -i "s/^version: \"?$extver\"?/version: \"$newver\"/1" CITATION.cff
|
2021-07-28 14:45:13 +02:00
|
|
|
sed -E -i "s/^date-released: .+$/date-released: $date/1" CITATION.cff
|
2021-04-10 12:44:11 +02:00
|
|
|
|
|
|
|
cargo check
|
|
|
|
|
2021-04-30 18:22:33 +02:00
|
|
|
git commit -am "cli: v$newver"
|
|
|
|
git tag -sam "watchexec-cli $newver" "cli-v$newver"
|
2021-04-10 12:44:11 +02:00
|
|
|
|
|
|
|
echo "Pushing to upstream"
|
|
|
|
git push --follow-tags $upstream $mainbranch
|