Skip to content

Instantly share code, notes, and snippets.

@Fitzy1293
Last active February 3, 2021 23:44
Show Gist options
  • Save Fitzy1293/cd36943e8e2f5d1d4c9c9168212c5d44 to your computer and use it in GitHub Desktop.
Save Fitzy1293/cd36943e8e2f5d1d4c9c9168212c5d44 to your computer and use it in GitHub Desktop.
#!/bin/sh
green='\e[0;32m'
cyan='\e[0;36m'
white='\e[0m'
blue='\e[1;34m'
echo "${cyan}Enter a package from pypi:${green}"
read package
pypiUrl="https://pypi.org/project/${package}/"
versionOnPypi="$(curl ${pypiUrl} -s | grep "<a class=\"card release__card\" href=\"/project/${package}/" -m 1 | cut -d'/' -f4)"
echo "${cyan}${pypiUrl} version:\n${blue}${versionOnPypi}"
echo "${cyan}Enter a new version for building with poetry:${green}"
read poetryVersion
echo "\n${cyan}Backing up pyproject.toml${cyan}" && cp -v pyproject.toml backup_config.toml
echo "\nUpdating pyproject.toml"
sed -i "s/^version.*=.*$/version = \"${poetryVersion}\"/" pyproject.toml
echo
poetry build
poetry publish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment