Introduces a new required 'token' input to the action. This token will be used for all GitHub API interactions, ensuring clear and explicit authentication, especially when accessing private repositories or repositories outside the current workflow's scope. This change replaces the previous 'github-token' and 'weld-repo-token' inputs with a single, mandatory 'token' input, making the action's authentication requirements unambiguous.
61 lines
1.9 KiB
YAML
61 lines
1.9 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'
|
|
repo:
|
|
description: 'The repository where the weld CLI is released, in owner/repo format.'
|
|
required: false
|
|
default: Xenox-Incorporated-Industries/weld
|
|
token:
|
|
description: 'A GitHub token with read access to the weld repository releases.'
|
|
required: true
|
|
|
|
branding:
|
|
icon: 'anchor'
|
|
color: 'blue'
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Get Version Tag for Download
|
|
id: get_version
|
|
shell: bash
|
|
env:
|
|
GH_TOKEN: ${{ inputs.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.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
|