Skip to content
Open
Show file tree
Hide file tree
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
19 changes: 17 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,25 @@ jobs:
command: --version

- name: echo outputs
run: echo '${{ steps.version.outputs.stdout }}'
shell: bash
run: |
echo '=== STDOUT ==='
echo "${{ steps.version.outputs.stdout }}"
echo '━━━━━━━━━━━━━・'

- name: echo release output (from GITHUB_OUTPUT)
shell: bash
run: |
echo '=== RELEASE (steps.version.outputs.release):'
if [ -n "${{ steps.version.outputs.release }}" ]; then
echo "${{ steps.version.outputs.release }}"
echo '━━━━━━━━━━━━━・'
else
echo '(no release output found)'
fi

- name: get CLI version (different cwd)
uses: ./
with:
command: --version
working-directory: .changes
working-directory: .changes
41 changes: 29 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Version: 0.0.1+test
# Last updated: 2025-11-11
# Changelog: Fixed output formatting to use simpler one line JSON format

name: 'cn-cloud-release'
description: 'CrabNebula Cloud Release GitHub Action'

inputs:
command:
description: 'The command to execute using the CrabNebula Cloud CLI'
Expand Down Expand Up @@ -40,11 +45,12 @@ runs:
# with:
# path: ${{ inputs.path }}/cn
# key: ${{ runner.os }}-${{ runner.arch }}-cn-${{ env.CURRENT_DATE }}
# ---> see bypassed condition below

- name: Download CLI (Linux)
- name: Download CLI
id: download-cn-cli
shell: bash
if: steps.restore-cache.outputs.cache-hit != 'true'
# if: steps.restore-cache.outputs.cache-hit != 'true' <--- bypassed condition
working-directory: ${{ inputs.path }}
env:
# Note: be careful about line-breaks for this parameter. Curl will break when they end up being sent as part of the header.
Expand All @@ -62,14 +68,14 @@ runs:
echo "Downloading CLI..."
if [[ "${{ runner.os }}" == "Linux" ]]; then
if [[ "${{ runner.arch }}" == "X64" ]]; then
curl -A "$USER_AGENT" -L https://cdn.crabnebula.app/download/crabnebula/cn-cli/latest/platform/linux-binary-x86_64 --output cn
curl -A "$USER_AGENT" -L https://cdn.crabnebula.app/download/crabnebula/test-cn-cli/latest/platform/linux-binary-x86_64 --output cn
else
curl -A "$USER_AGENT" -L https://cdn.crabnebula.app/download/crabnebula/cn-cli/latest/platform/linux-binary-aarch64 --output cn
curl -A "$USER_AGENT" -L https://cdn.crabnebula.app/download/crabnebula/test-cn-cli/latest/platform/linux-binary-aarch64 --output cn
fi
elif [[ "${{ runner.os }}" == "macOS" ]]; then
curl -A "$USER_AGENT" -L https://cdn.crabnebula.app/download/crabnebula/cn-cli/latest/platform/darwin-binary-universal --output cn
curl -A "$USER_AGENT" -L https://cdn.crabnebula.app/download/crabnebula/test-cn-cli/latest/platform/darwin-binary-universal --output cn
elif [[ "${{ runner.os }}" == "Windows" ]]; then
curl -A "$USER_AGENT" -L https://cdn.crabnebula.app/download/crabnebula/cn-cli/latest/platform/windows-binary-x86_64 --output cn
curl -A "$USER_AGENT" -L https://cdn.crabnebula.app/download/crabnebula/test-cn-cli/latest/platform/windows-binary-x86_64 --output cn
else
echo "unsupported runner ${{ runner.os }}, only Linux, macOS and Windows are supported"
exit 1
Expand All @@ -91,9 +97,20 @@ runs:
working-directory: ${{ inputs.working-directory }}
run: |
: run cn ${{ inputs.command }}
echo "running \"${{ steps.download-cn-cli.outputs.cn-path }}\" from '${{ inputs.working-directory }}'"
exec 5>&1
OUTPUT=$(${{ steps.download-cn-cli.outputs.cn-path }} ${{ inputs.command }} | tee >(cat - >&5))
echo "stdout<<nEOFn" >> $GITHUB_OUTPUT
echo "$OUTPUT" >> $GITHUB_OUTPUT
echo "nEOFn" >> $GITHUB_OUTPUT
echo "Running command from '${{ inputs.working-directory }}'"

# Run the command and capture output
# redirects file descriptor 2 (stderr)
# to the same location as file descriptor 1 (stdout)
set +e
OUTPUT=$("${{ steps.download-cn-cli.outputs.cn-path }}" ${{ inputs.command }} 2>&1)
EXIT_CODE=$?
set -e

# Display the output
echo "Release info: $OUTPUT"

# Save output to GITHUB_OUTPUT
echo "stdout=$OUTPUT" >> "$GITHUB_OUTPUT"

exit $EXIT_CODE