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

feat: add --skipTag flag #687

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat: add --skipTag flag #687

wants to merge 3 commits into from

Conversation

mpsanchis
Copy link

It would be useful to use the semver plugin as a version calculator, and then use the calculated ${version} or ${tag} at a later stage. For instance, run it at the beginning of a pipeline to get the version, and then use that version to build packages, images, charts, etc.
I have added a skipTag flag that allows running the plugin and not tagging the latest commit. In combination with skipCommit and skipProjectChangelog, one can run the plugin without modifying the repository.

An alternative would be to use dryRun, but this doesn't allow calling post targets.

@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Merging #687 (83c4392) into main (34c931a) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #687   +/-   ##
=======================================
  Coverage   96.78%   96.78%           
=======================================
  Files          28       28           
  Lines         591      591           
  Branches      100      100           
=======================================
  Hits          572      572           
  Misses          9        9           
  Partials       10       10           
Impacted Files Coverage Δ
packages/semver/src/executors/version/index.ts 98.24% <ø> (ø)
packages/semver/src/executors/version/version.ts 100.00% <ø> (ø)
packages/semver/src/executors/version/utils/git.ts 91.83% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@gazal-k
Copy link

gazal-k commented May 17, 2023

Thank you for this PR. I think we would need similar capability.

It would be useful to use the semver plugin as a version calculator, and then use the calculated ${version} or ${tag} at a later stage

How would you use this calculated version for other steps? And how would you ensure the same version is then used for creating the tag & a "release" on GitHub?

@mpsanchis
Copy link
Author

mpsanchis commented Jun 13, 2023

How would you use this calculated version for other steps?

I am already doing it with another home-made nx plugin. The version is stored as an environment variable, and other programs that publish packages/images/charts use that version in the registries they publish to.

how would you ensure the same version is then used for creating the tag & a "release" on GitHub?

Unfortunately, as of now, nx doesn't support passing options as env vars to executors, so some of them (such as ngx-deploy-npm:deploy and @jscutlery/semver:gitlab) must be post-targets. This means (for now) calling @jscutlery/semver:version twice (one for version calculation, and one for passing the version to the post-targets that cannot read env vars)

@edbzn edbzn force-pushed the main branch 2 times, most recently from e2d4357 to 369d933 Compare February 22, 2024 14:35
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

Successfully merging this pull request may close these issues.

2 participants