diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 14f40f2..0f0d2b3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 \ No newline at end of file diff --git a/action.yml b/action.yml index 44f52a5..0fde6f0 100644 --- a/action.yml +++ b/action.yml @@ -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' @@ -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. @@ -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 @@ -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<> $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