Skip to content

Conversation

@djgilcrease
Copy link
Contributor

@djgilcrease djgilcrease commented Jul 31, 2025

  • tag.output is required for mono repo structures if I need to run

    svu n --tag.prefix foo/v --tag.pattern 'foo/v*' --log.directory foo > foo/.version
    svu n --tag.prefix bla/v --tag.pattern 'bla/v*' --log.directory bla > bla/.version
    export BLA_NEXT=$(cat bla/.version)
    export FOO_NEXT=$(cat foo/.version)
    docker tag foo foo:${FOO_NEXT}
    docker tag bla bla:${BLA_NEXT}

    I do not want FOO and BLA _NEXT to have the prefix. So now I can do

    svu n --tag.prefix foo/v --tag.pattern 'foo/v*' --tag.output='v' --log.directory foo > foo/.version
    svu n --tag.prefix bla/v --tag.pattern 'bla/v*' --tag.output='v' --log.directory bla > bla/.version
    export BLA_NEXT=$(cat bla/.version)
    export FOO_NEXT=$(cat foo/.version)
    docker tag foo foo:${FOO_NEXT}
    docker tag bla bla:${BLA_NEXT}
  • fixes consider making config an argument #203 --config to be able to have multiple config files to make monorepo usage easier

  • fixes Support monorepo #224 allowing you to specify the config to use and which directories are used to calculate versions

  • I made sure the log.directory config entry works as relative to the config path so you can do
    ui-service/.svu.yml ->

    always: true
    tag:
      pattern: ui-service/v*
      prefix: ui-service/v
      output: ''
    log.directory:
      - "../uilib"
      - "."

    OR
    .ui-service.svu.yml ->

    always: true
    tag:
      pattern: ui-service/v*
      prefix: ui-service/v
      output: ''
    log.directory:
      - "uilib"
      - "ui-service"

@caarlos0
Copy link
Owner

caarlos0 commented Aug 8, 2025

I think you can simply set tag.prefix to an empty string 🤔

@djgilcrease
Copy link
Contributor Author

djgilcrease commented Aug 12, 2025 via email

@caarlos0
Copy link
Owner

maybe then we split --tag.prefix into --tag.prefix.input and --tag.prefix.output or something like that?

Or even make it a slice, so it could have --tag.prefix=input,output 🤔

@djgilcrease
Copy link
Contributor Author

maybe then we split --tag.prefix into --tag.prefix.input and --tag.prefix.output or something like that?

I like this, but will do --tag.prefix && --tag.prefix.output, will rework the PR and make output default to --tag.prefix

@pull-request-size pull-request-size bot added size/L and removed size/M labels Aug 19, 2025
@djgilcrease djgilcrease changed the title feat: add tag.strip-prefix bool feat: add tag.output to manage the tag output Aug 19, 2025
@djgilcrease
Copy link
Contributor Author

Updated and it ended up being --tag.output since --tag.prefix.output did not parse properly with --tag.prefix being a string and I felt --tag.prefix.input was ugly AF and would be a breaking change.

* tag.strip-prefix is required for mono repo structures
	if I need to run
		```shell
		svu n --tag.prefix foo/v --tag.pattern 'foo/v*' --log.directory foo > foo/.version
		svu n --tag.prefix bla/v --tag.pattern 'bla/v*' --log.directory bla > bla/.version
		export BLA_NEXT=$(cat bla/.version)
		export FOO_NEXT=$(cat foo/.version)
		docker tag foo foo:${FOO_NEXT}
		docker tag bla bla:${BLA_NEXT}
		```
	I do not want FOO and BLA _NEXT to have the prefix

* added --config to be able to have multiple config files to make monorepo usage easier
@djgilcrease djgilcrease requested a review from caarlos0 November 19, 2025 00:10
@caarlos0
Copy link
Owner

@aymanbagabas I think you use this with monorepos as well, wanna give this a look?

@djgilcrease djgilcrease mentioned this pull request Nov 21, 2025
@aymanbagabas
Copy link
Contributor

@aymanbagabas I think you use this with monorepos as well, wanna give this a look?

I still use this wrapper script to achieve this

        #!/usr/bin/env bash
        root=$(git rev-parse --show-toplevel)
        if [ "$PWD" != "$root" ]; then
          prefix=$(echo -n "$PWD" | sed "s|$root/||g")
          svu --tag.prefix="$prefix/v" --tag.pattern="$prefix/*" "$@"
        else
          svu "$@"
        fi

@djgilcrease
Copy link
Contributor Author

@aymanbagabas would #224 (comment) help? It is similar, but lets you define the prefix in the config for each module in the mono repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support monorepo consider making config an argument

3 participants