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

Use variables (including Version) with multiple packages #988

Open
BatmanAoD opened this issue Apr 3, 2024 · 5 comments
Open

Use variables (including Version) with multiple packages #988

BatmanAoD opened this issue Apr 3, 2024 · 5 comments

Comments

@BatmanAoD
Copy link
Collaborator

BatmanAoD commented Apr 3, 2024

There should be a way to use Knope's variables, including Version, with multiple packages.

[old description]

Since determining the version of a package is nontrivial, and it's often useful in scripts (e.g. in CI), I think it would be a great feature if Knope could detect the current version(s) of packages and print that, without doing anything else.

Users could probably parse this information out of knope release --dry-run, but that's a bit awkward.

The primary use case I'm thinking of is to replace stuff like git describe --abbrev=0 --tags | sed 's/v//', so the output must be easy to parse. For a standard, single package, it could just print the version it finds; for multiple packages, it could print <name>=<version>, one on each line. Just like release, when a package has multiple versioned files and their versions don't match, it should just print an error of some kind.

@dbanty
Copy link
Member

dbanty commented Apr 3, 2024

For single packages, this would work today:

[[workflows]]
name = "print-version"

[[workflows.steps]]
type = "Command"
command = "echo $version"
variables = { "$version" = "Version" }

For multi-package setups, we'd have to decide on something new. We really need a way to use variables with multiple packages anyway 😅.

Would you want all versions in a single workflow (output with JSON maybe?) or run a specific workflow to get a specific package version?

@dbanty
Copy link
Member

dbanty commented Apr 4, 2024

(I guess my suggestion is exactly what you had in #885)

@BatmanAoD
Copy link
Collaborator Author

I completely forgot I had asked for that, and didn't see it in the issues list when I searched 😅

@dbanty dbanty changed the title Command to print the current package version(s) Get versions for multiple packages Apr 13, 2024
@dbanty
Copy link
Member

dbanty commented Apr 13, 2024

Converting this issue to specifically figure out outputting versions for multiple packages (since #885 / #994 will cover the single-package case)

@BatmanAoD BatmanAoD changed the title Get versions for multiple packages Use variables (including Version) with multiple packages Jul 24, 2024
@BatmanAoD
Copy link
Collaborator Author

I've updated the issue title & description accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants