Files
setup-weld/action.yml
OmentaElvis d78a286676 fix(action): explicitly resolve 'latest' version tag
The previous logic for detecting the 'latest' weld version relied on 'gh release download' interpreting an empty tag argument as the latest release. This was causing issues in consumer workflows, as it was seemingly looking for a literal 'latest' tag.

This commit updates the 'Get Version Tag for Download' step to explicitly query the GitHub API for the actual tag name of the latest release when 'weld-version' is set to 'latest'. This ensures a concrete tag is always provided to the download command, making the action more robust.
2025-12-20 16:00:49 +03:00

62 lines
2.1 KiB
YAML

name: 'Setup Weld CLI'
description: 'Downloads a specific version of the weld CLI from a GitHub release, makes it executable, and adds it to the PATH.'
inputs:
weld-version:
description: 'The version of weld to install (e.g., v0.2.0). Defaults to the latest release.'
required: false
default: 'latest' # Use 'latest' as a special keyword
repo:
description: 'The repository where the weld CLI is released, in owner/repo format.'
required: false
default: Xenox-Incorporated-Industries/weld
github-token:
description: 'GitHub token for downloading from a private repository. The default token is usually sufficient within the same organization.'
required: false
default: ${{ github.token }}
branding:
icon: 'anchor'
color: 'blue'
runs:
using: "composite"
steps:
- name: Get Version Tag for Download
id: get_version
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
run: |
VERSION_TAG=""
if [[ "${{ inputs.weld-version }}" == "latest" ]]; then
echo "Figuring out the latest version..."
# Get the tag name of the latest release from the specified repo
VERSION_TAG=$(gh release view --repo ${{ inputs.repo }} --json tagName --jq .tagName)
echo "Latest version is ${VERSION_TAG}"
else
VERSION_TAG="${{ inputs.weld-version }}"
echo "Using specified version ${VERSION_TAG}"
fi
echo "tag=${VERSION_TAG}" >> $GITHUB_OUTPUT
- name: Download Weld CLI
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
run: |
echo "Downloading weld version '${{ inputs.weld-version }}' from repo '${{ inputs.repo }}'..."
gh release download ${{ steps.get_version.outputs.tag }} \
--repo ${{ inputs.repo }} \
--pattern 'weld-binary-*' \
--output ./weld
echo "Download complete."
- name: Make Weld CLI executable
shell: bash
run: chmod +x ./weld
- name: Add Weld CLI to PATH
shell: bash
run: echo "$(pwd)" >> $GITHUB_PATH