Skip to content

Commit 9ce2e95

Browse files
author
Steven Silvester
authored
Merge pull request #152 from jtpio/settings-registry
Move registry options to settings
2 parents 76f9925 + 3895adb commit 9ce2e95

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

.github/workflows/publish-release.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ on:
55
release_url:
66
description: "The URL of the draft GitHub release"
77
required: true
8-
pypi_registry:
9-
description: "The PYPI registry"
10-
default: https://pypi.org/simple/
11-
npm_registry:
12-
description: "The npm registry"
13-
default: https://registry.npmjs.org/
148
jobs:
159
publish_release:
1610
runs-on: ubuntu-latest
@@ -39,9 +33,7 @@ jobs:
3933
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
4034
PYPI_TOKEN_MAP: ${{ secrets.PYPI_TOKEN_MAP }}
4135
TWINE_USERNAME: __token__
42-
TWINE_REGISTRY: ${{ github.event.inputs.pypi_registry }}
4336
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
44-
NPM_REGISTRY: ${{ github.event.inputs.npm_registry }}
4537
uses: jupyter-server/jupyter_releaser/.github/actions/publish-release@v1
4638
with:
4739
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}

jupyter_releaser/cli.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,11 +567,27 @@ def extract_release(auth, dist_dir, dry_run, release_url, npm_install_options):
567567
envvar="TWINE_COMMAND",
568568
default="twine upload",
569569
)
570+
@click.option(
571+
"--npm-registry",
572+
help="The npm registry to target for publishing",
573+
envvar="NPM_REGISTRY",
574+
default="https://registry.npmjs.org/",
575+
)
576+
@click.option(
577+
"--twine-registry",
578+
help="The pypi register to target for publishing",
579+
envvar="TWINE_REGISTRY",
580+
default="https://pypi.org/simple/",
581+
)
570582
@add_options(dry_run_options)
571583
@use_checkout_dir()
572-
def publish_assets(dist_dir, npm_token, npm_cmd, twine_cmd, dry_run):
584+
def publish_assets(
585+
dist_dir, npm_token, npm_cmd, twine_cmd, npm_registry, twine_registry, dry_run
586+
):
573587
"""Publish release asset(s)"""
574-
lib.publish_assets(dist_dir, npm_token, npm_cmd, twine_cmd, dry_run)
588+
lib.publish_assets(
589+
dist_dir, npm_token, npm_cmd, twine_cmd, npm_registry, twine_registry, dry_run
590+
)
575591

576592

577593
@main.command()

jupyter_releaser/lib.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,13 @@ def parse_release_url(release_url):
372372
return match
373373

374374

375-
def publish_assets(dist_dir, npm_token, npm_cmd, twine_cmd, dry_run):
375+
def publish_assets(
376+
dist_dir, npm_token, npm_cmd, twine_cmd, npm_registry, twine_registry, dry_run
377+
):
376378
"""Publish release asset(s)"""
379+
os.environ["NPM_REGISTRY"] = npm_registry
380+
os.environ["TWINE_REGISTRY"] = twine_registry
381+
377382
if dry_run:
378383
# Start local pypi server with no auth, allowing overwrites,
379384
# in a temporary directory

jupyter_releaser/tests/test_cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def test_list_envvars(runner):
157157
links-expire: RH_LINKS_EXPIRE
158158
npm-cmd: RH_NPM_COMMAND
159159
npm-install-options: RH_NPM_INSTALL_OPTIONS
160+
npm-registry: NPM_REGISTRY
160161
npm-token: NPM_TOKEN
161162
output: RH_CHANGELOG_OUTPUT
162163
post-version-message: RH_POST_VERSION_MESSAGE
@@ -170,6 +171,7 @@ def test_list_envvars(runner):
170171
tag-format: RH_TAG_FORMAT
171172
tag-message: RH_TAG_MESSAGE
172173
twine-cmd: TWINE_COMMAND
174+
twine-registry: TWINE_REGISTRY
173175
username: GITHUB_ACTOR
174176
version-cmd: RH_VERSION_COMMAND
175177
version-spec: RH_VERSION_SPEC

0 commit comments

Comments
 (0)