Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,28 @@ jobs:
fi
- name: Get npm tag
id: npm-tag
shell: bash
run: |
$regex = "^v?(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:[^.]*)))?"
$version = "${{ steps.get-version.outputs.VERSION }}"
$releaseChannel = $groups["prerelease"][0].value
set -e
VERSION="${{ steps.get-version.outputs.VERSION }}"

# Extract the release channel (latest, alpha, beta, rc)
if [[ $VERSION =~ ^v?[0-9]+\.[0-9]+\.[0-9]+(-(.+))?$ ]]; then
if [[ -n "${BASH_REMATCH[2]}" ]]; then
CAPTURED_CHANNEL="${BASH_REMATCH[2]}"
# The captured channel might have more dots, cases like
# v1.2.3-alpha.1 For such cases we only want the channel relevant
# part which is alpha.
RELEASE_CHANNEL="${CAPTURED_CHANNEL%%.*}"
else
RELEASE_CHANNEL="latest"
fi
else
echo "::error title=Invalid Version::Encountered unexpected version ${{ steps.get-version.outputs.VERSION }}, cannot proceed!"
exit 1
fi

if ([string]::IsNullOrEmpty($releaseChannel)) {
$releaseChannel = "latest"
}
Write-Output "RELEASE_CHANNEL=$releaseChannel" >> $Env:GITHUB_OUTPUT
echo "RELEASE_CHANNEL=${RELEASE_CHANNEL}" >> "$GITHUB_OUTPUT"
- name: Output deployment info
run: echo "::notice title=Deployment Info::Deploying version ${{ steps.get-version.outputs.VERSION }} to channel ${{ steps.npm-tag.outputs.RELEASE_CHANNEL }}"

Expand Down
Loading