Skip to content

fix double help

fix double help #539

# This is the github action that builds the conda distribution and uploads it
name: conda-build
on:
push:
branches: ["main", "master"]
tags:
- 'v[0-9]*.*' # v1, v1.2, v1.2.3, v2025.09.04, etc.
- '[0-9]*\.[0-9]*\.*' # 1, 1.2, 1.2.3, 2025.09.04, etc.
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
cache-downloads: true
environment-name: tools
# The python here should be coordinated with pyproj.toml.
# The others are a minimal set of things needed to bootstrap the build
# and should be coordinated with pyproj.toml as far as things like minimum versions
create-args: >-
python=3.12
setuptools>68
numpy>2
conda-build
boa
anaconda-client
setuptools-scm
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