Check in my ‘deploy to PyPI’ script
- ID
45395d4- date
2024-01-02 09:34:16+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
d4f5f4f- message
Check in my 'deploy to PyPI' script- changed files
2 files, 44 additions, 1 deletion
Changed files
flickr/README.md (1709) → flickr/README.md (2214)
diff --git a/flickr/README.md b/flickr/README.md
index 7238dc0..2460709 100644
--- a/flickr/README.md
+++ b/flickr/README.md
@@ -18,6 +18,12 @@ folder_name = "flickr"
scripts = [
{
+ "usage": "deploy_to_pypi",
+ "description": """
+ deploy a new version of a Flickr Foundation Python library: bump the version, tag the Git commit, push to PyPI and GitHub.
+ """,
+ },
+ {
"usage": "flapi.sh [METHOD] [PARAMS]",
"description": """
call a method with the Flickr API and print the XML response to stdout.
@@ -42,6 +48,15 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
]]]-->
<dl>
<dt>
+ <a href="https://github.com/alexwlchan/scripts/blob/main/flickr/deploy_to_pypi">
+ <code>deploy_to_pypi</code>
+ </a>
+ </dt>
+ <dd>
+ deploy a new version of a Flickr Foundation Python library: bump the version, tag the Git commit, push to PyPI and GitHub.
+ </dd>
+
+ <dt>
<a href="https://github.com/alexwlchan/scripts/blob/main/flickr/flapi.sh">
<code>flapi.sh [METHOD] [PARAMS]</code>
</a>
@@ -68,4 +83,4 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
Look up a Flickr user by URL or path alias.
</dd>
</dl>
-<!-- [[[end]]] (checksum: 37fb345f2f059bad0669a7c8411516b9) -->
+<!-- [[[end]]] (checksum: c6023a15d18d6ef6f489f55f8b032b9a) -->
flickr/deploy_to_pypi (0) → flickr/deploy_to_pypi (763)
diff --git a/flickr/deploy_to_pypi b/flickr/deploy_to_pypi
new file mode 100755
index 0000000..10f08d5
--- /dev/null
+++ b/flickr/deploy_to_pypi
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+# Deploy a new version of a Flickr Foundation Python library:
+#
+# 1. Bump the version
+# 2. Tag the Git commit
+# 3. Push to PyPI and GitHub.
+#
+# This probably works for other projects as well, but relies on certain
+# aspects of the way the repos are laid out that may not be universal.
+#
+# Note: unlike most Python scripts in this repo, this should run in
+# the project virtualenv rather than the script virtualenv.
+
+set -o errexit
+set -o nounset
+
+python3 -m build
+python3 -m twine upload dist/* --username=__token__ --skip-existing
+
+version=$(find src -name __init__.py \
+ | xargs grep '__version__ =' \
+ | awk '{print $3}' \
+ | tr -d '"')
+
+echo "Tagging as v$version and pushing to GitHub"
+
+git tag "v$version"
+git push origin --tag