Compare commits

..

No commits in common. "main" and "dev-local-backup" have entirely different histories.

3 changed files with 2 additions and 95 deletions

2
Cargo.lock generated
View File

@ -551,7 +551,7 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
[[package]]
name = "git-remote-k8s"
version = "0.2.0"
version = "0.1.2-alpha.1"
dependencies = [
"anyhow",
"clap",

View File

@ -3,7 +3,7 @@ name = "git-remote-k8s"
description = "a git remote helper to use PVCs as a remote"
authors = ["James Andariese"]
readme = "README.md"
version = "0.2.0"
version = "0.1.2-alpha.1"
edition = "2021"
license = "AGPL-3.0-only"
keywords = ["git", "remote", "kubernetes"]

View File

@ -1,93 +0,0 @@
#!/bin/sh
### whatif (patch|minor|major|alpha|rc|beta)
whatif() {(
set -e
TMPPREFIX=/tmp/tmp.releaser-whatif
T="$(mktemp -d "${TMPPREFIX}.XXXXXXXX")"
cleanup() { (set -x;rm -rf "/tmp/${TMPPREFIX#/tmp/}${T#$TMPPREFIX}"); }
trap "cleanup;exit 1" SIGINT SIGTERM
git clone . "$T" &> /dev/null
cargo set-version --manifest-path "$T/Cargo.toml" --bump "$1" &> /dev/null
tomlq -r .package.version "$T/Cargo.toml"
rm -rf "/tmp/${TMPPREFIX#/tmp/}${T#$TMPPREFIX}"
cleanup
)}
if [ $# -eq 0 ];then
echo "crate releaser:"
echo
printf "% 8s : %s\n" name version
printf "% 8s : %s\n" -------- --------
for f in major minor patch rc beta alpha;do
printf "% 8s : %s\n" $f "$(whatif "$f")"
done
echo "
Call with any of the above arguments to change this crate's version
to the associated version:
$0 [major|minor|patch|rc|beta|alpha]
"
exit 0
fi
BUMP="$1"
if [ x"$(git branch --show-current)" != xdev ];then
1>&2 echo this can only be run from the dev branch
exit 1
fi
if [ ! -d .git ] || [ ! -f Cargo.toml ];then
1>&2 echo this can only be run from the root of a rust git repo
exit 1
fi
if git status --porcelain | grep -q . ;then
git status || true
1>&2 echo can only be run on a clean git tree
exit 1
fi
upgrade() {
cargo set-version --bump "$BUMP"
VERSION="$(tomlq -r .package.version Cargo.toml)"
git add Cargo.toml Cargo.lock
git commit -m "release $VERSION"
git merge main
git checkout main
git merge dev
git tag "$VERSION"
git checkout dev
cargo set-version --bump alpha
NEW_VERSION="$(tomlq -r .package.version Cargo.toml)"
git add Cargo.toml Cargo.lock
git commit -m "a new version appears: $NEW_VERSION"
}
(
set -e
echo "smoke testing the release process first..."
TMPPREFIX="/tmp/tmp.releaser-testrun"
T="$(mktemp -d "${TMPPREFIX}.XXXXXXXX")"
cleanup() { (set -x; rm -rf "/tmp/${TMPPREFIX#/tmp/}${T#$TMPPREFIX}"); }
trap "cleanup;exit 1" SIGINT SIGTERM
git clone . "$T"
cd "$T"
kill -INT $$
git checkout main
git checkout dev
upgrade "$BUMP"; echo $?
cleanup
); RC=$?
if [ $RC -ne 0 ]; then
1>&2 echo "smoke test failed. aborting!"
exit 1
fi
(
set -e
upgrade
)