Skip to content

Commit 36ae1fe

Browse files
authored
Add wheels upload to anaconda (#1809)
1 parent d7082ad commit 36ae1fe

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

.github/workflows/conda-package.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,11 @@ jobs:
9797
miniconda-version: 'latest'
9898
activate-environment: 'build'
9999

100-
- if: matrix.os == 'ubuntu-20.04'
101-
name: Store conda paths as envs on Linux
102-
run: echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/linux-64/" >> $GITHUB_ENV
103-
104-
- if: matrix.os == 'windows-latest'
105-
name: Store conda paths as envs on Win
100+
- name: Store conda paths as envs
101+
shell: bash -l {0}
106102
run: |
107-
@echo on
108-
(echo CONDA_BLD=%CONDA_PREFIX%\conda-bld\win-64\) >> %GITHUB_ENV%
103+
echo "CONDA_BLD=$CONDA_PREFIX/conda-bld/${{ runner.os == 'Linux' && 'linux' || 'win' }}-64/" | tr "\\" '/' >> $GITHUB_ENV
104+
echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE${{ runner.os == 'Linux' && '/' || '\\' }}" >> $GITHUB_ENV
109105
110106
- name: Install conda-build
111107
run: conda install conda-build=${{ env.CONDA_BUILD_VERSION}}
@@ -131,6 +127,12 @@ jobs:
131127
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
132128
path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.tar.bz2
133129

130+
- name: Upload wheels artifact
131+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
132+
with:
133+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
134+
path: ${{ env.WHEELS_OUTPUT_FOLDER }}${{ env.PACKAGE_NAME }}-*.whl
135+
134136
test_linux:
135137
name: Test ['${{ matrix.os }}', python='${{ matrix.python }}']
136138

@@ -410,7 +412,7 @@ jobs:
410412

411413
defaults:
412414
run:
413-
shell: ${{ matrix.os == 'windows-latest' && 'cmd /C CALL {0}' || 'bash -l {0}' }}
415+
shell: bash -l {0}
414416

415417
continue-on-error: true
416418

@@ -424,6 +426,11 @@ jobs:
424426
with:
425427
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }}
426428

429+
- name: Download wheels artifact
430+
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
431+
with:
432+
name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
433+
427434
- name: Setup miniconda
428435
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
429436
with:
@@ -435,11 +442,19 @@ jobs:
435442
- name: Install anaconda-client
436443
run: conda install anaconda-client
437444

445+
- name: Package version
446+
run: echo "PACKAGE_VERSION=$(basename ${{ env.PACKAGE_NAME }}-*.tar.bz2 | sed 's/^${{ env.PACKAGE_NAME }}-\([^-]*\).*/\1/')" >> $GITHUB_ENV
447+
438448
- name: Upload
439449
run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.tar.bz2
440450
env:
441451
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
442452

453+
- name: Upload wheels
454+
run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.whl --version ${{ env.PACKAGE_VERSION }}
455+
env:
456+
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
457+
443458
cleanup_packages:
444459
name: Clean up anaconda packages
445460
needs: [upload]

0 commit comments

Comments
 (0)