Add to documentation dependencies #456
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: conda-build | |
| on: | |
| push: | |
| branches: ["main", "master"] | |
| tags: | |
| - 'v*' # v1, v1.2, v1.2.3, v2025.09.04, etc. | |
| - '[0-9]*' # 1, 1.2, 1.2.3, 2025.09.04, etc. | |
| paths: | |
| - "conda.recipe/**" | |
| - ".github/workflows/python-package-conda.yml" | |
| - "pyproject.toml" | |
| - "schimpy/**" | |
| - "scripts/**" | |
| - "tests/**" | |
| pull_request: | |
| paths: | |
| - "conda.recipe/**" | |
| - ".github/workflows/python-package-conda.yml" | |
| - "pyproject.toml" | |
| - "schimpy/**" | |
| - "scripts/**" | |
| - "tests/**" | |
| workflow_dispatch: | |
| concurrency: | |
| group: conda-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # full history | |
| fetch-tags: true | |
| # Export a temp build dir and pip hardening | |
| - name: Set temp-based paths | |
| run: | | |
| echo "MAMBA_ROOT_PREFIX=${RUNNER_TEMP}/mamba" >> "$GITHUB_ENV" | |
| echo "CONDA_BLD_PATH=${RUNNER_TEMP}/conda-bld" >> "$GITHUB_ENV" | |
| echo "PIP_NO_BUILD_ISOLATION=1" >> "$GITHUB_ENV" | |
| echo "PIP_NO_INDEX=1" >> "$GITHUB_ENV" | |
| echo "PIP_NO_DEPS=1" >> "$GITHUB_ENV" | |
| - name: Set up micromamba (create + cache env) | |
| uses: mamba-org/setup-micromamba@v2 | |
| with: | |
| micromamba-version: "latest" | |
| init-shell: bash | |
| cache-environment: true # ✅ now valid | |
| cache-downloads: true | |
| environment-name: tools | |
| create-args: >- | |
| python>=3.10 | |
| conda-build | |
| boa | |
| anaconda-client | |
| setuptools-scm | |
| conda-verify | |
| condarc: | | |
| channel_priority: strict | |
| channels: | |
| - conda-forge | |
| - cadwr-dms | |
| - name: Show env | |
| shell: bash -l {0} | |
| run: | | |
| micromamba activate tools | |
| python -V | |
| conda info | |
| - name: Compute version from setuptools-scm | |
| shell: bash -l {0} | |
| run: | | |
| micromamba activate tools | |
| # 1) tag -> version | |
| if [[ "${GITHUB_REF:-}" == refs/tags/* ]]; then | |
| V="${GITHUB_REF_NAME#v}" | |
| else | |
| # 2) setuptools-scm (needs fetch-depth: 0) | |
| V=$(python -m setuptools_scm 2>/dev/null || true) | |
| fi | |
| # 3) fallback to 0.0.0+SHA | |
| [[ -z "$V" ]] && V="0.0.0+${GITHUB_SHA::7}" | |
| echo "PKG_VERSION=$V" | tee -a "$GITHUB_ENV" | |
| echo "SETUPTOOLS_SCM_PRETEND_VERSION=$V" | tee -a "$GITHUB_ENV" | |
| - name: Build conda recipe (no tests first) | |
| shell: bash -l {0} | |
| run: | | |
| micromamba activate tools | |
| conda mambabuild conda.recipe --no-test | |
| - name: Test conda recipe (optional) | |
| if: always() | |
| shell: bash -l {0} | |
| run: | | |
| micromamba activate tools | |
| conda mambabuild conda.recipe -c conda-forge -c cadwr-dms | |
| - name: Upload to Anaconda (if token configured) | |
| if: env.ANACONDA_CHANNEL_UPLOAD_TOKEN != '' | |
| shell: bash -l {0} | |
| env: | |
| ANACONDA_CHANNEL_UPLOAD_TOKEN: ${{ secrets.ANACONDA_CHANNEL_UPLOAD_TOKEN }} | |
| run: | | |
| micromamba activate tools | |
| anaconda -t "$ANACONDA_CHANNEL_UPLOAD_TOKEN" upload --label main "$CONDA_BLD_PATH"/*/*.tar.bz2 |