#!/usr/bin/env sh VERSION="$1" TAG="release-v${VERSION}" KEY="${HOME}/.config/ssh/id_arrdem@tirefireind" TON="${HOME}/ton" 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 mkdir -p "${TON}/key" cp "${KEY}.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 "${KEY}" -n "${SIG}" "${BUILD}" git checkout trunk