#!/usr/bin/env sh VERSION="$1" TAG="release-v${VERSION}" if git tag | grep "$TAG"; then git checkout "$TAG" else git reset --hard git clean -fd sed -i "s/__version__.*/__version__ = \"${VERSION}\"/g" src/python/cram/__init__.py git commit src/python/cram/__init__.py -m "[automated] Release version ${VERSION}" git tag "release-v${VERSION}" git push git push --tags fi bazel build cram TON="$HOME/ton" mkdir -p "$TON/key" cp ~/.ssh/id_arrdem@arrdem.pub "$TON/key" chmod 644 "$TON/key"/* D="$TON/pkg/arrdem/cram/v${VERSION}" BUILD="${D}/cram" SIG="${D}/cram.sig" mkdir -p "$D" cp -f ./bazel-bin/cram "${BUILD}" rm -f "${SIG}" ssh-keygen -Y sign -f ~/.ssh/id_arrdem@arrdem -n "${SIG}" "${BUILD}" git checkout trunk