69 lines
2.3 KiB
YAML
69 lines
2.3 KiB
YAML
name: 'Setup Weld CLI'
|
|
description: 'Downloads Weld CLI from Gitea releases and adds it to the PATH.'
|
|
|
|
inputs:
|
|
weld-version:
|
|
description: 'Version to install (e.g., v0.2.0). Defaults to latest.'
|
|
required: false
|
|
default: 'latest'
|
|
repo:
|
|
description: 'The owner/repo on Gitea.'
|
|
required: false
|
|
default: 'interkonnekted/weld'
|
|
token:
|
|
description: 'Gitea Personal Access Token (PAT).'
|
|
required: true
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Get Release Metadata
|
|
id: get_version
|
|
shell: bash
|
|
run: |
|
|
GITEA_URL="https://git.xenoxindustries.com"
|
|
|
|
if [[ "${{ inputs.weld-version }}" == "latest" ]]; then
|
|
ENDPOINT="api/v1/repos/${{ inputs.repo }}/releases/latest"
|
|
else
|
|
ENDPOINT="api/v1/repos/${{ inputs.repo }}/releases/tags/${{ inputs.weld-version }}"
|
|
fi
|
|
|
|
# Fetch release JSON from Gitea API
|
|
RESPONSE=$(curl -sL -H "Authorization: token ${{ inputs.token }}" "$GITEA_URL/$ENDPOINT")
|
|
echo $RESPONSE
|
|
|
|
# Extract Tag and Download URL for the asset named 'weld'
|
|
TAG=$(echo $RESPONSE | jq -r '.tag_name')
|
|
# This jq filter finds the asset named 'weld' and gets its download URL
|
|
DL_URL=$(echo $RESPONSE | jq -r '.assets[] | select(
|
|
(.name == "weld" or (.name | startswith("weld-binary-")) or (.name | startswith("weld-")))
|
|
and (.name | endswith(".deb") | not)
|
|
) | .browser_download_url' | head -n 1)
|
|
|
|
if [[ -z "$DL_URL" || "$DL_URL" == "null" ]]; then
|
|
echo "❌ ERROR: Could not find a valid 'weld' binary in the release assets."
|
|
echo "Available assets: $(echo "$RESPONSE" | jq -r '.assets[].name')"
|
|
exit 1
|
|
fi
|
|
|
|
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
echo "url=$DL_URL" >> $GITHUB_OUTPUT
|
|
|
|
- name: Download Weld CLI
|
|
shell: bash
|
|
run: |
|
|
echo "Downloading Weld from ${{ steps.get_version.outputs.url }}..."
|
|
curl -L -H "Authorization: token ${{ inputs.token }}" \
|
|
-o ./weld \
|
|
"${{ steps.get_version.outputs.url }}"
|
|
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
|