From a30d0d2937aca465763703ef0fe868da8f46d97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Tue, 13 Sep 2022 15:25:23 +0200 Subject: [PATCH] Fix publish-release (#378) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .github/workflows/full-release.yml | 1 + jupyter_releaser/lib.py | 4 ++-- jupyter_releaser/util.py | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/full-release.yml b/.github/workflows/full-release.yml index 9a08df3a..449a6c1d 100644 --- a/.github/workflows/full-release.yml +++ b/.github/workflows/full-release.yml @@ -45,6 +45,7 @@ jobs: uses: ./.github/actions/publish-release with: token: ${{ secrets.ADMIN_GITHUB_TOKEN }} + target: ${{ github.event.inputs.target }} release_url: ${{ steps.draft-release.outputs.release_url }} - name: "** Next Step **" diff --git a/jupyter_releaser/lib.py b/jupyter_releaser/lib.py index 529fe579..645cb2bc 100644 --- a/jupyter_releaser/lib.py +++ b/jupyter_releaser/lib.py @@ -169,7 +169,7 @@ def draft_changelog( current_sha=current_sha, ) with tempfile.TemporaryDirectory() as d: - metadata_path = Path(d) / "metadata.json" + metadata_path = Path(d) / util.METADATA_JSON with open(metadata_path, "w") as fid: json.dump(data, fid) @@ -432,7 +432,7 @@ def extract_release( commit_message = "" commit_message = util.run(f"git log --format=%B -n 1 {sha}") - for asset in assets: + for asset in filter(lambda a: a.name != util.METADATA_JSON.name, assets): # Check the sha against the published sha valid = False path = dist / asset.name diff --git a/jupyter_releaser/util.py b/jupyter_releaser/util.py index 29b3c9f3..b4843f22 100644 --- a/jupyter_releaser/util.py +++ b/jupyter_releaser/util.py @@ -39,6 +39,7 @@ MANIFEST = Path("MANIFEST.in") YARN_LOCK = Path("yarn.lock") JUPYTER_RELEASER_CONFIG = Path(".jupyter-releaser.toml") +METADATA_JSON = Path("metadata.json") BUF_SIZE = 65536 TBUMP_CMD = "tbump --non-interactive --only-patch" @@ -448,7 +449,7 @@ def extract_metadata_from_release_url(gh, release_url, auth): data = None for asset in release.assets: - if asset.name != "metadata.json": + if asset.name != METADATA_JSON.name: continue log(f"Fetching {asset.name}...") @@ -464,7 +465,9 @@ def extract_metadata_from_release_url(gh, release_url, auth): data = json.loads(sink.read().decode("utf-8")) if data is None: - raise ValueError(f'Could not find "metadata.json" file in draft release {release_url}') + raise ValueError( + f'Could not find "{METADATA_JSON.name}" file in draft release {release_url}' + ) # Update environment variables. if "post_version_spec" in data: