mtkennerly / dunamai-action

GitHub Action for Dunamai
MIT License
7 stars 1 forks source link

[FR] Expose available version properties as outputs #3

Open webknjaz opened 5 months ago

webknjaz commented 5 months ago

Hi, I'd like to use the action not only to detect a version but use its other properties. In the Python ecosystem, the versions are PEP 440 style. In my workflows, I create GitHub Releases that have a boolean for whether said version is a pre-release. It would be useful to have an output is-pre-release that could be used to set this flag. A poor man's check would be to see if a version string contains one of 'a', 'b', 'c' or 'd'. However, it seems like dunamai should already have this information internally, so why not expose it? FWIW, I think I'll use this simple check for now. Another useful bit could be exposing if a version has a PEP 440 local version identifier part. It could be called is-untagged-commit. Perhaps, a more generic solution would be exposing the string components as major, minor, patch (aliased as micro, perhaps) and local.

mtkennerly commented 5 months ago

Hi! You can do something like this currently:

      - uses: mtkennerly/dunamai-action@v1
        with:
          env-var: VERSION_DISTANCE
          args: --format "{distance}"
      - uses: mtkennerly/dunamai-action@v1
        with:
          env-var: VERSION_STAGE
          args: --format "{stage}"

Then to determine the info you want: