Skip to content

Commit c679538

Browse files
committed
[fix/ci] move to explicit anaconda commands
1 parent 24bfb97 commit c679538

File tree

1 file changed

+54
-12
lines changed

1 file changed

+54
-12
lines changed

.github/workflows/build_and_upload_conda_packages.yaml

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,65 @@ jobs:
2626
auto-update-conda: false
2727
auto-activate-base: false
2828
show-channel-urls: true
29+
channels: conda-forge, defaults
30+
conda-remove-defaults: true
2931

3032
- name: Get version from version.txt
3133
id: get_version
3234
run: |
3335
PYATLAN_VERSION=$(cat pyatlan/version.txt | tr -d ' \n')
34-
echo "version=$PYATLAN_VERSION" >> $GITHUB_OUTPUT
3536
echo "PYATLAN_VERSION=$PYATLAN_VERSION" >> $GITHUB_ENV
3637
echo "Building version: $PYATLAN_VERSION"
3738
38-
- name: Build and upload the conda packages
39-
uses: uibcdf/[email protected]
40-
with:
41-
meta_yaml_dir: .conda-envs
42-
python-version: ${{ matrix.python-version }}
43-
platform_all: true
44-
user: atlanhq
45-
label: main
46-
token: ${{ secrets.ANACONDA_API_TOKEN }}
47-
upload: true
48-
version: ${{ steps.get_version.outputs.version }}
39+
- name: Install conda-build and anaconda-client
40+
run: |
41+
conda config --add channels conda-forge
42+
conda config --add channels defaults
43+
conda config --set auto_activate false
44+
conda install conda-build anaconda-client anaconda-auth -y
45+
46+
- name: Build conda package
47+
env:
48+
PYATLAN_VERSION: ${{ env.PYATLAN_VERSION }}
49+
run: |
50+
echo "Building conda package with version: $PYATLAN_VERSION"
51+
conda build .conda-envs/meta.yaml --python ${{ matrix.python-version }} --output-folder /tmp/conda-builds --package-format tar.bz2
52+
53+
- name: Convert to all platforms
54+
run: |
55+
# Find the built package
56+
PACKAGE_PATH=$(find /tmp/conda-builds -name "*.tar.bz2" | head -1)
57+
if [ -z "$PACKAGE_PATH" ]; then
58+
echo "No package found to convert"
59+
exit 1
60+
fi
61+
echo "Found package: $PACKAGE_PATH"
62+
conda convert -p all "$PACKAGE_PATH" -o /tmp/conda-builds
63+
64+
- name: Upload to Anaconda
65+
env:
66+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
67+
run: |
68+
# Find anaconda command
69+
ANACONDA_CMD=""
70+
for cmd in anaconda "$CONDA/bin/anaconda" "$CONDA/condabin/anaconda" "$(which anaconda)"; do
71+
if command -v "$cmd" >/dev/null 2>&1; then
72+
ANACONDA_CMD="$cmd"
73+
echo "Found anaconda command: $ANACONDA_CMD"
74+
break
75+
fi
76+
done
77+
78+
if [ -z "$ANACONDA_CMD" ]; then
79+
echo "anaconda command not found. Installing anaconda-client..."
80+
conda install anaconda-client anaconda-auth -y
81+
ANACONDA_CMD="anaconda"
82+
fi
83+
84+
# Upload all platform packages
85+
for pkg in /tmp/conda-builds/*/*.tar.bz2; do
86+
if [ -f "$pkg" ]; then
87+
echo "Uploading $pkg..."
88+
$ANACONDA_CMD upload --user atlanhq --label main "$pkg"
89+
fi
90+
done

0 commit comments

Comments
 (0)