Skip to content

Commit

Permalink
add script to publish from tag
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian Huber <maximilian.huber@tngtech.com>
  • Loading branch information
maxhbr committed Jul 14, 2023
1 parent 9b8183e commit 8a24096
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions publish_from_tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

set -euo pipefail
version="0.8.0rc2"
tag="v${version}"
tar_gz="https://github.com/spdx/tools-python/releases/download/${tag}/spdx_tools_dist.tar.gz"
tag_dir="dist-${tag}"

cd -- "$(dirname "$0")"

if ! command -v twine &> /dev/null; then
echo "twine could not be found"
echo "maybe load venv with"
echo " . ./venv/bin/activate"
echo " . ./venv/bin/activate.fish"
echo
echo "will try to avtivate..."

source ./venv/bin/activate
fi


if [[ -d "$tag_dir" ]]; then
echo "the dir \"$tag_dir\" already exists, exiting for safety"
exit 1
fi

mkdir -p "$tag_dir"
(cd "$tag_dir" && wget -c "$tar_gz" -O - | tar --strip-components=1 -xz)

twine check "${tag_dir}/spdx-tools-${version}.tar.gz" "${tag_dir}/spdx_tools-${version}-py3-none-any.whl"
read -r -p "Do you want to upload? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
twine upload -r pypi "${tag_dir}/spdx-tools-${version}.tar.gz" "${tag_dir}/spdx_tools-${version}-py3-none-any.whl"
;;
esac

0 comments on commit 8a24096

Please sign in to comment.