Skip to content

Commit 059f6c3

Browse files
authored
Merge pull request #7 from 4dn-dcic/kmp_add_make_target_publish
Add a 'publish' target in the Makefile
2 parents 8dda026 + b3dc9df commit 059f6c3

3 files changed

Lines changed: 48 additions & 1 deletion

File tree

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@ release: clean
3030

3131
install: clean
3232
poetry install
33+
34+
publish:
35+
@bin/publish
36+

bin/publish

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
if [ -z "$PYPI_USER" ]; then
4+
echo '$PYPI_USER is not set.'
5+
exit 1
6+
fi
7+
8+
if [ -z "$PYPI_PASSWORD" ]; then
9+
echo '$PYPI_PASSWORD is not set.'
10+
exit 1
11+
fi
12+
13+
changes=`git diff`
14+
15+
if [ -n "${changes}" ]; then
16+
echo "You have made changes to this branch that you have not committed."
17+
exit 1
18+
fi
19+
20+
staged_changes=`git diff --staged`
21+
22+
if [ -n "${staged_changes}" ]; then
23+
echo "You have staged changes to this branch that you have not committed."
24+
exit 1
25+
fi
26+
27+
tagged=`git log -1 --decorate | head -1 | grep 'tag:'`
28+
29+
if [ -z "$tagged" ]; then
30+
# We don't encourage people to tag it unless they have no changes pending.
31+
echo "You can only publish a tagged commit."
32+
exit 1
33+
fi
34+
35+
read -p "Are you sure you want to publish $(poetry version) to PyPi? "
36+
REPLY=`echo "$REPLY" | tr '[:upper:]' '[:lower:]'`
37+
if [ "$REPLY" != 'y' ] && [ "$REPLY" != "yes" ]
38+
then
39+
echo "Publishing aborted."
40+
exit 1
41+
fi
42+
43+
poetry publish --no-interaction --build --username=$PYPI_USER --password=$PYPI_PASSWORD

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "python-lambda-4dn"
3-
version = "2.0.0b2"
3+
version = "2.0.0b3"
44
description = "A forked version of python-lambda for 4DN-DCIC use in packaging and deploying lambda functions."
55
authors = ["4DN-DCIC Team <support@4dnucleome.org>"]
66
license = "MIT"

0 commit comments

Comments
 (0)