Skip to content

Commit

Permalink
Add publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
davet2001 committed Dec 21, 2023
1 parent 08cafca commit d30bf8b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@
"postCreateCommand": "pip3 install --user -r requirements.txt -r requirements_test.txt",

// Priviledged mode is necessary to get access to usb
"runArgs": ["--privileged"]
"runArgs": ["--privileged"],

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
//"remoteUser": "root"

// Access local .pypi api keys
"mounts": [
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.pypirc,target=/home/vscode/.pypirc,type=bind,consistency=cached"
]
}
36 changes: 36 additions & 0 deletions scripts/publish_to_pypi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# Script to automate publishing to pypi
# Dave T 2023-12-21
pypi_config_file=~/.pypirc

pip install twine

if [ ! -f dist/*.tar.gz ]; then
echo "No releases found. Please run python3 -m setup.py sdist"
exit
fi
twine check dist/*

echo "Ready to publish."
echo "Default is publishing to testpypi."
read -r -p "If you are fully ready, please publish to pypi by typing 'thisisnotatest'<enter>: " response
echo "response=$response"
if [ "$response" = "thisisnotatest" ]; then
repository=pypi
else
repository=testpypi
fi

if [ -f $pypi_config_file ]; then
echo "Using $pypi_config_file for API keys"
else
echo "$pypi_config_file not found, please paste pypi API token below:"
read twine_api_key
export TWINE_USERNAME=__token__
export TWINE_PASSWORD=$twine_api_key
fi
echo "Publishing to $repository..."
twine upload --repository $repository dist/*
echo "Publishing complete!"
echo
echo "Don't forget to tag this release!"

0 comments on commit d30bf8b

Please sign in to comment.