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
29 changes: 16 additions & 13 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: 'Version'
description: 'A tool to handle version numbers'
name: "Version"
description: "A tool to handle version numbers"
inputs:
version:
description: 'Explicit version to use (e.g. v0.1.5). Defaults to the action tag.'
description: "Explicit version to use (e.g. v0.1.5). Defaults to the action tag."
required: false
command:
description: 'Command to run (bump or latest)'
description: "Command to run (bump or latest)"
required: true
args:
description: 'Arguments to pass to the command'
description: "Arguments to pass to the command"
required: true
outputs:
version:
description: 'The output of the command'
description: "The output of the command"
value: ${{ steps.version-cli.outputs.version }}
runs:
using: "composite"
Expand All @@ -26,7 +26,7 @@ runs:
run: |
# If input is empty, fall back to the action's pinned tag (e.g., v0.1.5)
VERSION="${INPUT_VERSION:-$ACTION_REF}"

if [[ "$VERSION" =~ ^[0-9a-f]{40}$ ]]; then
echo "::error::When pinning by SHA, you must explicitly provide the 'version' input."
echo "Please update your workflow:"
Expand All @@ -35,12 +35,12 @@ runs:
echo " version: v0.1.5 # <--- Required"
exit 1
fi

if [ -z "$VERSION" ]; then
echo "Error: Could not determine version. Please pin the action or provide a version input."
exit 1
fi

echo "Resolved version: $VERSION"

# --- 2. MAP OS & ARCH ---
Expand All @@ -66,14 +66,14 @@ runs:
# --- 3. CONSTRUCT URL ---
FILENAME="version_${OS_TYPE}_${ARCH_TYPE}.tar.gz"
URL="https://github.com/version-cli/version/releases/download/${VERSION}/${FILENAME}"

echo "Downloading from: $URL"

# --- 4. DOWNLOAD & INSTALL ---
curl -sLf -H "Authorization: Bearer $GITHUB_TOKEN" "$URL" -o "version.tar.gz"

mkdir -p "$HOME/.local/bin"

tar -xzf "version.tar.gz" -C "$HOME/.local/bin" "$BINARY_NAME"

# --- 5. UPDATE PATH ---
Expand All @@ -87,5 +87,8 @@ runs:
COMMAND: ${{ inputs.command }}
ARGS: ${{ inputs.args }}
run: |
OUTPUT=$(version "$COMMAND" $ARGS)
echo "version=$OUTPUT" >> $GITHUB_OUTPUT
{
echo "version<<EOF"
version "$COMMAND" $ARGS
echo "EOF"
} >> "$GITHUB_OUTPUT"
Loading