88 description : ' API key with write permissions for CrabNebula Cloud'
99 required : true
1010 path :
11- description : ' Optional path to run the CLI in, needs to be a valid directory path (Unix syntax)'
11+ description : ' Optional path to a directory where the CLI should be downloaded, needs to be a valid path (Unix syntax)'
12+ required : false
13+ default : ' .'
14+ working-directory :
15+ description : ' Current working directory to use when running the CLI'
1216 required : false
1317 default : ' .'
1418
@@ -20,30 +24,61 @@ outputs:
2024runs :
2125 using : ' composite'
2226 steps :
23- - name : Download CLI (unix)
27+ - name : Cache CLI
28+ id : restore-cache
29+ uses : actions/cache/restore@v4
30+ with :
31+ path : ${{ inputs.path }}/cn
32+ key : ${{ runner.os }}-${{ runner.arch }}-cn
33+
34+ - name : Download CLI (Linux)
2435 shell : bash
25- if : runner.os == 'Linux' || runner.os == 'macOS'
36+ if : steps.restore-cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
37+ working-directory : ${{ inputs.path }}
2638 run : |
27- cd ${{ inputs.path }}
28- curl -L https://cdn.crabnebula.app/download/01HKMY6ZXJA3P0QHA5GQY8KKRT/latest/cn_${{ runner.os == 'Linux' && 'linux' || 'macos' }} --output cn
39+ : Download CLI
40+ echo "Downloading CLI..."
41+ if [[ "${{ runner.arch }}" == "X64" ]]; then
42+ curl -L https://cdn.crabnebula.app/download/crabnebula/cn-cli/latest/platform/linux-binary-x86_64 --output cn
43+ else
44+ curl -L https://cdn.crabnebula.app/download/crabnebula/cn-cli/latest/platform/linux-binary-aarch64 --output cn
45+ fi
46+ chmod +x cn
47+
48+ - name : Download CLI (macOS)
49+ shell : bash
50+ if : steps.restore-cache.outputs.cache-hit != 'true' && runner.os == 'macOS'
51+ working-directory : ${{ inputs.path }}
52+ run : |
53+ : Download CLI
54+ echo "Downloading CLI..."
55+ curl -L https://cdn.crabnebula.app/download/crabnebula/cn-cli/latest/platform/darwin-binary-universal --output cn
2956 chmod +x cn
3057
3158 - name : Download CLI (Windows)
3259 shell : bash
33- if : runner.os == 'Windows'
60+ if : steps.restore-cache.outputs.cache-hit != 'true' && runner.os == 'Windows'
61+ working-directory : ${{ inputs.path }}
3462 run : |
35- cd ${{ inputs.path }}
36- curl -L https://cdn.crabnebula.app/download/01HKMY6ZXJA3P0QHA5GQY8KKRT/latest/cn_windows.exe --output cn
63+ : Download CLI
64+ echo "Downloading CLI..."
65+ curl -L https://cdn.crabnebula.app/download/crabnebula/cn-cli/latest/platform/windows-binary-x86_64 --output cn
66+
67+ - uses : actions/cache/save@v4
68+ with :
69+ path : ${{ inputs.path }}/cn
70+ key : ${{ steps.restore-cache.outputs.cache-primary-key }}
3771
3872 - name : " Run Command"
3973 id : run-command
4074 shell : bash
4175 env :
4276 CN_API_KEY : ${{ inputs.api-key }}
77+ working-directory : ${{ inputs.working-directory }}
4378 run : |
44- cd ${{ inputs.path }}
45- OUTPUT=$(./cn ${{ inputs.command }})
79+ : cn ${{ inputs.command }}
80+ exec 5>&1
81+ OUTPUT=$(./"${{ inputs.path }}"/cn ${{ inputs.command }} | tee >(cat - >&5))
4682 echo "stdout<<nEOFn" >> $GITHUB_OUTPUT
4783 echo "$OUTPUT" >> $GITHUB_OUTPUT
4884 echo "nEOFn" >> $GITHUB_OUTPUT
49-
0 commit comments