Update release_conda.yml #41
Workflow file for this run
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: Release Conda | |
| on: | |
| push: | |
| branches: [conda_cd] | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| condapublish: | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| id-token: write | |
| contents: write | |
| deployments: write | |
| statuses: write | |
| actions: write | |
| checks: read | |
| env: | |
| CONDA_NO_PLUGINS: true | |
| CONDA_PKGS_DIRS: ~/conda_pkgs_dir | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Miniforge | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniforge-version: latest | |
| use-mamba: true | |
| auto-update-conda: false | |
| activate-environment: "" | |
| auto-activate-base: true | |
| - name: Cache conda packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/conda_pkgs_dir | |
| key: conda-pkgs-${{ runner.os }}-${{ hashFiles('environment.yml') }} | |
| - name: Create conda environment | |
| run: | | |
| mamba env create -f environment.yml --quiet | |
| - name: Install pip dependencies | |
| run: | | |
| mamba run -n dl1dh pip install -U pydot --quiet | |
| - name: Install conda-build and anaconda-client | |
| run: | | |
| mamba install -y -c conda-forge conda-build anaconda-client | |
| # Detectar ruta base de conda (segura en cualquier runner) | |
| - name: Detect Conda base path | |
| id: conda_path | |
| run: | | |
| echo "CONDA_BASE=$(conda info --base)" >> $GITHUB_ENV | |
| echo "Conda base is: $(conda info --base)" | |
| - name: Verify conda-build installation | |
| run: | | |
| source $CONDA_BASE/etc/profile.d/conda.sh | |
| conda activate base | |
| which conda | |
| conda --version | |
| conda build --version || echo "conda-build not found" | |
| - name: Determine version from Git tag | |
| id: git_version | |
| run: | | |
| echo "GIT_DESCRIBE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
| - name: Set dynamic version in meta.yaml | |
| run: | | |
| VERSION_NUMBER="${GIT_DESCRIBE_TAG#v}" | |
| echo "Setting version to $VERSION_NUMBER" | |
| sed -i "s|^{% set version.*%}|{% set version = \"$VERSION_NUMBER\" %}|" .github/conda/meta.yaml | |
| - name: Build conda package | |
| run: | | |
| source $CONDA_BASE/etc/profile.d/conda.sh | |
| conda activate base | |
| echo "Conda build version: $(conda build --version)" | |
| PACKAGE_FILE=$(conda build .github/conda --output) | |
| echo "Building package: $PACKAGE_FILE" | |
| conda build .github/conda --quiet | |
| - name: Upload package to Anaconda.org | |
| env: | |
| ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
| run: | | |
| source $CONDA_BASE/etc/profile.d/conda.sh | |
| conda activate base | |
| PACKAGE_FILE=$(conda build .github/conda --output) | |
| echo "Uploading package: $PACKAGE_FILE" | |
| anaconda upload "$PACKAGE_FILE" --user ctlearn-project --label main --force |