File tree Expand file tree Collapse file tree 1 file changed +20
-7
lines changed Expand file tree Collapse file tree 1 file changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -45,15 +45,28 @@ jobs:
4545 fi
4646 - name : Get npm tag
4747 id : npm-tag
48+ shell : bash
4849 run : |
49- $regex = "^v?(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:[^.]*)))?"
50- $version = "${{ steps.get-version.outputs.VERSION }}"
51- $releaseChannel = $groups["prerelease"][0].value
50+ set -e
51+ VERSION="${{ steps.get-version.outputs.VERSION }}"
52+
53+ # Extract the release channel (latest, alpha, beta, rc)
54+ if [[ $VERSION =~ ^v?[0-9]+\.[0-9]+\.[0-9]+(-(.+))?$ ]]; then
55+ if [[ -n "${BASH_REMATCH[2]}" ]]; then
56+ CAPTURED_CHANNEL="${BASH_REMATCH[2]}"
57+ # The captured channel might have more dots, cases like
58+ # v1.2.3-alpha.1 For such cases we only want the channel relevant
59+ # part which is alpha.
60+ RELEASE_CHANNEL="${CAPTURED_CHANNEL%%.*}"
61+ else
62+ RELEASE_CHANNEL="latest"
63+ fi
64+ else
65+ echo "::error title=Invalid Version::Encountered unexpected version ${{ steps.get-version.outputs.VERSION }}, cannot proceed!"
66+ exit 1
67+ fi
5268
53- if ([string]::IsNullOrEmpty($releaseChannel)) {
54- $releaseChannel = "latest"
55- }
56- Write-Output "RELEASE_CHANNEL=$releaseChannel" >> $Env:GITHUB_OUTPUT
69+ echo "RELEASE_CHANNEL=${RELEASE_CHANNEL}" >> "$GITHUB_OUTPUT"
5770 - name : Output deployment info
5871 run : echo "::notice title=Deployment Info::Deploying version ${{ steps.get-version.outputs.VERSION }} to channel ${{ steps.npm-tag.outputs.RELEASE_CHANNEL }}"
5972
You can’t perform that action at this time.
0 commit comments