Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying the tag in publish_oci_artifact #22

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/eq/devtools/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import click

from .. import __version__
from ._conda import conda
from ._test import test
from .conda import conda
from .github import github


Expand Down
1 change: 1 addition & 0 deletions src/eq/devtools/cli/conda/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._conda import conda
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def conda():
pass


@conda.command()
@conda.command(name="render")
@click.option(
"--version",
type=str,
Expand Down Expand Up @@ -62,7 +62,7 @@ def render(
)


@conda.command()
@conda.command(name="build")
@click.option(
"--recipe-file",
type=Optional[str],
Expand Down Expand Up @@ -98,7 +98,7 @@ def build(
)


@conda.command()
@conda.command(name="publish")
@click.option(
"--filepath", type=str, help="The filepath to the `.conda` package to publish."
)
Expand All @@ -107,11 +107,18 @@ def build(
type=str,
help="The GitHub user or organisation to publish the package to.",
)
@click.option(
"--tag",
type=str,
default=None,
help="An optional tag to use instead of the package version.",
)
@click.option(
"-v",
"--verbose",
is_flag=True,
default=False,
help="A flag to enable verbose output for the `powerloader` command.",
)
@click.option(
"--token",
Expand All @@ -130,6 +137,7 @@ def build(
def publish(
filepath,
owner,
tag,
verbose,
token,
debug,
Expand All @@ -138,6 +146,7 @@ def publish(
publish_oci_artifact(
filepath=filepath,
owner=owner,
tag=tag,
verbose=verbose,
token=token,
debug=debug,
Expand Down
4 changes: 3 additions & 1 deletion src/eq/devtools/conda/_publish_oci.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def publish_oci_artifact(
filepath: str | Path,
*,
owner: str,
tag: str | None = None,
verbose: bool = False,
token: str | None = None,
debug: bool = False,
Expand All @@ -37,8 +38,9 @@ def publish_oci_artifact(
cmd = ["powerloader upload"]
if verbose:
cmd += ["-v"]
tag = tag or version.replace("+", "-")
cmd += [
f"{filepath}:conda/{filename}:{version.replace('+', '-')}",
f"{filepath}:conda/{filename}:{tag}",
"-m oci://ghcr.io",
]
cmd = " ".join(cmd)
Expand Down