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:
|
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.
The regular expression for
GitVersionPrereleaseget-gitversion/action.yml
Lines 44 to 45 in 1ecd47c
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-:Moreover, the documentation in:
get-gitversion/README.md
Lines 12 to 19 in 1ecd47c
v1.0, ignoring the usage of theGitVersionPrereleaseoutput introduced withv1.1.