Skip to content

Commit 68dca29

Browse files
committed
feat(pypi): flag to skip PyPI and publish only to GitHub
1 parent 0e1a396 commit 68dca29

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

clit/dev.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,11 @@ def pypi():
184184
@click.option(
185185
"--allow-dirty", "-d", default=False, is_flag=True, type=bool, help="Allow bumpversion to run on a dirty repo"
186186
)
187+
@click.option(
188+
"--github-only", "-g", default=False, is_flag=True, type=bool, help="Skip PyPI and publish only to GitHub"
189+
)
187190
@click.pass_context
188-
def full(ctx, part, allow_dirty: bool):
191+
def full(ctx, part, allow_dirty: bool, github_only: bool):
189192
"""The full process to upload to PyPI (bump version, changelog, package, upload)."""
190193
# Recreate the setup.py
191194
ctx.invoke(setup_py)
@@ -222,17 +225,18 @@ def full(ctx, part, allow_dirty: bool):
222225
+ "Changes will be committed, files will be uploaded to PyPI, a GitHub release will be created"
223226
)
224227

225-
commands = (
228+
commands = [
226229
("Add all files and commit (skipping hooks)", PyPICommands.GIT_ADD_AND_COMMIT.format(commit_message)),
227230
("Push", PyPICommands.GIT_PUSH),
228231
(
229232
"Create the tag but don't push it yet (conventional-github-releaser will do that)",
230233
PyPICommands.GIT_TAG.format(new_version),
231234
),
232235
("Upload the files to TestPyPI via Twine", PyPICommands.TWINE_UPLOAD.format(repo="-r testpypi")),
233-
("Upload the files to PyPI via Twine", PyPICommands.TWINE_UPLOAD.format(repo="")),
234-
("Create a GitHub release", PyPICommands.GITHUB_RELEASE),
235-
)
236+
]
237+
if not github_only:
238+
commands.append(("Upload the files to PyPI via Twine", PyPICommands.TWINE_UPLOAD.format(repo="")))
239+
commands.append(("Create a GitHub release", PyPICommands.GITHUB_RELEASE))
236240
for header, command in commands:
237241
while True:
238242
click.secho(f"\n>>> {header}", fg="bright_white")

0 commit comments

Comments
 (0)