Skip to content

Commit 858b0a8

Browse files
committed
get which command to use from previous step
1 parent f07f5c4 commit 858b0a8

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

publish/action.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,21 @@ runs:
3737
using: "composite"
3838
steps:
3939
- name: Check for anaconda and pixi commands
40+
id: get_command
4041
shell: bash
4142
run: |
42-
if ! command -v anaconda &> /dev/null; then
43-
if ! command -v pixi &> /dev/null; then
44-
echo "Error: Neither 'anaconda' nor 'pixi' command found. Please install the Anaconda Client or Pixi CLI to use this action."
45-
exit 1
46-
else
43+
# if `anaconda` command is available, use it directly; otherwise, check for `pixi` and install `anaconda-client` if needed
44+
if command -v anaconda &> /dev/null; then
45+
echo "'anaconda' command found. Using it for upload."
46+
echo "CMD=anaconda" >> $GITHUB_OUTPUT
47+
else
48+
if command -v pixi &> /dev/null; then
4749
echo "'pixi' command found. Installing anaconda-client via pixi..."
4850
pixi global install anaconda-client
51+
echo "CMD='pixi run anaconda'" >> $GITHUB_OUTPUT
52+
else
53+
echo "Error: Neither 'anaconda' nor 'pixi' command found. Please install the Anaconda Client or Pixi CLI to use this action."
54+
exit 1
4955
fi
5056
fi
5157
@@ -61,6 +67,8 @@ runs:
6167
run: |
6268
set -euo pipefail
6369
70+
set CMD=${{ steps.get_command.outputs.CMD }}
71+
6472
if [ "${LABEL}" = "" ]; then
6573
echo "No label input provided. Determining label from GitHub ref '${REF}'..."
6674
case "${REF}" in
@@ -81,7 +89,7 @@ runs:
8189
fi
8290
8391
echo "Uploading ${PACKAGE_PATH} to ${ORGANIZATION} with label '${LABEL}'"
84-
anaconda \
92+
${CMD} \
8593
--token "${ANACONDA_API_TOKEN}" \
8694
upload \
8795
--user "${ORGANIZATION}" \

0 commit comments

Comments
 (0)