Skip to content

Issues with the GitVersionPrerelease output #4

@g-galante

Description

@g-galante

The regular expression for GitVersionPrerelease

id: prereleaseVer
run: echo "VER=`tap sdk gitversion | sed -n 's/.*-\([^+]*\).*/\1/p'`" >> $GITHUB_OUTPUT
is too greedy. Check, for instance:

$ echo 1.0.0-alpha.9.1+3832890c.upgrade-all-actions-to-node16 | sed -n 's/.*-\([^+]*\).*/\1/p'
node16

which should have returned alpha.9.1.

This can be easily fixed by limiting the regex greediness, replacing the initial .*- with [^-]*-, to prevent it from swallowing every character (+ included) until the last -, and making it instead stop on the first -:

$ echo 1.0.0-alpha.9.1+3832890c.upgrade-all-actions-to-node16 | sed -n 's/[^-]*-\([^+]*\)+.*/\1/p'
alpha.9.1

Moreover, the documentation in:

get-gitversion/README.md

Lines 12 to 19 in 1ecd47c

outputs:
ShortVersion: ${{ steps.gitversion.outputs.ShortVersion }}
LongVersion: ${{ steps.gitversion.outputs.LongVersion }}
GitVersion: ${{ steps.gitversion.outputs.GitVersion }}
steps:
- name: GitVersion
id: gitversion
uses: opentap/get-gitversion@v1.0
still references v1.0, ignoring the usage of the GitVersionPrerelease output introduced with v1.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions