Update release_conda.yml #42
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_PKGS_DIRS: ~/conda_pkgs_dir | |
| steps: | |
| # 1️⃣ Checkout repo | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # 2️⃣ Set up Miniforge + Mamba | |
| - 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 | |
| # 3️⃣ Cache de paquetes | |
| - name: Cache conda packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/conda_pkgs_dir | |
| key: conda-pkgs-${{ runner.os }}-${{ hashFiles('environment.yml') }} | |
| # 4️⃣ Crear entorno del proyecto | |
| - name: Create conda environment | |
| run: | | |
| mamba env create -f environment.yml --quiet | |
| # 5️⃣ Instalar pip deps extra | |
| - name: Install pip dependencies | |
| run: | | |
| mamba run -n dl1dh pip install -U pydot --quiet | |
| # 6️⃣ Instalar conda-build y anaconda-client | |
| - name: Install conda-build and anaconda-client | |
| run: | | |
| mamba install -y -c conda-forge conda-build anaconda-client | |
| conda build --version | |
| anaconda --version | |
| # 7️⃣ Detectar ruta base de Conda | |
| - name: Detect Conda base path | |
| id: conda_path | |
| run: | | |
| echo "CONDA_BASE=$(conda info --base)" >> $GITHUB_ENV | |
| echo "Conda base is: $CONDA_BASE" | |
| # 8️⃣ Obtener versión del tag | |
| - name: Determine version from Git tag | |
| id: git_version | |
| run: | | |
| echo "GIT_DESCRIBE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
| # 9️⃣ Sustituir versión en meta.yaml | |
| - name: Set dynamic version in meta.yaml | |
| run: | | |
| VERSION_NUMBER="${GIT_DESCRIBE_TAG#v}" | |
| sed -i "s|^{% set version.*%}|{% set version = \"$VERSION_NUMBER\" %}|" .github/conda/meta.yaml | |
| # 🔟 Build del paquete Conda | |
| - name: Build conda package | |
| env: | |
| CONDA_NO_PLUGINS: false # necesario para conda-build | |
| run: | | |
| source $CONDA_BASE/etc/profile.d/conda.sh | |
| conda activate base | |
| PACKAGE_FILE=$(conda build .github/conda --output) | |
| echo "Building package: $PACKAGE_FILE" | |
| conda build .github/conda --quiet | |
| # 1️⃣1️⃣ Subida a Anaconda.org | |
| - name: Upload package to Anaconda.org | |
| env: | |
| ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
| CONDA_NO_PLUGINS: false | |
| run: | | |
| source $CONDA_BASE/etc/profile.d/conda.sh | |
| conda activate base | |
| PACKAGE_FILE=$(conda build .github/conda --output) | |
| anaconda upload "$PACKAGE_FILE" --user ctlearn-project --label main --force |