Skip to content

Commit 6875532

Browse files
authored
Merge pull request #701 from atlanhq/fix-conda-workflow
[fix/ci] Fix conda packages publish GitHub workflow
2 parents 97b017b + 426a1d5 commit 6875532

File tree

5 files changed

+98
-64
lines changed

5 files changed

+98
-64
lines changed

.conda-envs/build-env.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
channels: # write here the list of channels to look for your library dependencies
22
- atlanhq
33
- conda-forge
4-
- default
4+
- nodefaults
55

66
dependencies: # Keep this block with only these two packages
77
- anaconda-client

.conda-envs/meta.yaml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
package:
22
name: "pyatlan"
3-
version: "{{ environ['GIT_DESCRIBE_TAG'] }}"
3+
version: "{{ environ['PYATLAN_VERSION'] }}"
44

55
source:
66
path: ../
77

88
build:
99
number: 0
10+
noarch: python
1011
script: "{{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation"
1112

1213
requirements:
1314
host:
14-
- jinja2 ~=3.1.6
15-
- lazy_loader~=0.4
1615
- pip
17-
- pydantic ~=2.11.7
16+
- setuptools
1817
- python
19-
- requests ~=2.32.4
20-
- tenacity ~=9.1.2
21-
- urllib3 >=1.26.0,<3
2218
run:
19+
- python >=3.9,<3.13
2320
- jinja2 ~=3.1.6
24-
- lazy_loader~=0.4
21+
- lazy_loader ~=0.4
2522
- pydantic ~=2.11.7
26-
- python
23+
- python-dateutil ~=2.9.0.post0
24+
- pytz ~=2025.2
25+
- PyYAML ~=6.0.2
2726
- requests ~=2.32.4
28-
- tenacity ~=9.1.2
27+
- tenacity ~=9.0.0
2928
- urllib3 >=1.26.0,<3
3029

31-
3230
about:
3331
home: "https://github.com/atlanhq/atlan-python"
3432
license: Apache Software

.github/workflows/build_and_upload_conda_packages.yaml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/pyatlan-pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
matrix:
1212
# Specify version as a string
1313
# https://github.com/actions/setup-python/issues/160"
14-
python-version: ["3.9", "3.12", "3.13"]
14+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
1515

1616
steps:
1717
- name: Checkout code
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Publish Pyatlan Package to Anaconda
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
conda_deployment:
10+
name: Build and upload noarch (all platforms) package
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Conda environment creation and activation
18+
uses: conda-incubator/setup-miniconda@v3
19+
with:
20+
python-version: "3.9"
21+
environment-file: .conda-envs/build-env.yaml
22+
auto-update-conda: false
23+
auto-activate-base: false
24+
show-channel-urls: true
25+
channels: conda-forge
26+
conda-remove-defaults: "true"
27+
28+
- name: Get version from version.txt
29+
id: get_version
30+
run: |
31+
PYATLAN_VERSION=$(cat pyatlan/version.txt | tr -d ' \n')
32+
echo "PYATLAN_VERSION=$PYATLAN_VERSION" >> $GITHUB_ENV
33+
echo "Building version: $PYATLAN_VERSION"
34+
35+
- name: Install conda-build and anaconda-client
36+
run: |
37+
conda install conda-build anaconda-client anaconda-auth -y
38+
39+
- name: Build noarch conda package
40+
env:
41+
PYATLAN_VERSION: ${{ env.PYATLAN_VERSION }}
42+
run: |
43+
echo "Building noarch conda package with version: $PYATLAN_VERSION"
44+
conda build .conda-envs/meta.yaml --output-folder /tmp/conda-builds --package-format tar.bz2
45+
46+
- name: Upload to Anaconda
47+
env:
48+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
49+
run: |
50+
# Find anaconda command
51+
ANACONDA_CMD=""
52+
for cmd in anaconda "$CONDA/bin/anaconda" "$CONDA/condabin/anaconda" "$(which anaconda)"; do
53+
if command -v "$cmd" >/dev/null 2>&1; then
54+
ANACONDA_CMD="$cmd"
55+
echo "Found anaconda command: $ANACONDA_CMD"
56+
break
57+
fi
58+
done
59+
60+
if [ -z "$ANACONDA_CMD" ]; then
61+
echo "anaconda command not found. Installing anaconda-client..."
62+
conda install anaconda-client anaconda-auth -y
63+
ANACONDA_CMD="anaconda"
64+
fi
65+
66+
# Upload the noarch package
67+
for pkg in /tmp/conda-builds/*/*.tar.bz2; do
68+
if [ -f "$pkg" ]; then
69+
echo "Uploading noarch package: $pkg"
70+
UPLOAD_OUTPUT=$($ANACONDA_CMD upload --user atlanhq --label main "$pkg" 2>&1)
71+
UPLOAD_EXIT_CODE=$?
72+
73+
echo "Upload output for $pkg:"
74+
echo "$UPLOAD_OUTPUT"
75+
echo "Exit code: $UPLOAD_EXIT_CODE"
76+
77+
if [ $UPLOAD_EXIT_CODE -eq 0 ]; then
78+
echo "Successfully uploaded: $pkg"
79+
elif echo "$UPLOAD_OUTPUT" | grep -q "already exists\|Conflict"; then
80+
echo "Package already exists, skipping: $pkg"
81+
else
82+
echo "Upload failed for $pkg (exit code: $UPLOAD_EXIT_CODE):"
83+
echo "$UPLOAD_OUTPUT"
84+
exit 1
85+
fi
86+
fi
87+
done

0 commit comments

Comments
 (0)