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
12 changes: 10 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ jobs:
run: |
# Defaults to 'latest' for release events, otherwise uses dispatch input (which defaults to 'dev').
CHANNEL="${{ github.event.inputs.channel || 'latest' }}"
BRANCH="${{ github.ref_name }}"

# For release events, github.ref_name is the tag name, not the branch.
# Get the branch name from the release target_commitish or default branch.
if [ "${{ github.event_name }}" = "release" ]; then
BRANCH="${{ github.event.release.target_commitish }}"
else
BRANCH="${{ github.ref_name }}"
fi

# Restrict 'latest' channel to master branch only
if [ "$CHANNEL" = "latest" ] && [ "$BRANCH" != "master" ]; then
Expand All @@ -46,14 +53,15 @@ jobs:
fi

echo "channel=$CHANNEL" >> $GITHUB_OUTPUT
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
echo "Publishing to channel: $CHANNEL from branch: $BRANCH"

- name: Validate and set version
id: version
run: |
VERSION="${{ github.event.inputs.version }}"
CHANNEL="${{ steps.channel.outputs.channel }}"
BRANCH="${{ github.ref_name }}"
BRANCH="${{ steps.channel.outputs.branch }}"

# If version is provided, validate it
if [ -n "$VERSION" ]; then
Expand Down