Skip to content

Commit aceafa2

Browse files
authored
Merge pull request #671 from ReactionMechanismGenerator/fix_conda_build
2 parents 64dd3b6 + 1c22f7d commit aceafa2

1 file changed

Lines changed: 31 additions & 7 deletions

File tree

.github/workflows/conda_build.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,48 @@ jobs:
1313
shell: bash -l {0}
1414
steps:
1515
- uses: actions/checkout@v4
16+
17+
# Step to create a custom condarc.yml before setting up conda
18+
- name: Create custom conda config file
19+
run: |
20+
RUNNER_CWD=$(pwd)
21+
echo "channels:" > $RUNNER_CWD/condarc.yml
22+
echo " - conda-forge" >> $RUNNER_CWD/condarc.yml
23+
echo "show_channel_urls: true" >> $RUNNER_CWD/condarc.yml
24+
1625
- name: Setup Conda
1726
uses: conda-incubator/setup-miniconda@v3
1827
with:
28+
miniforge-variant: Miniforge3
29+
miniforge-version: latest
30+
use-mamba: true
31+
condarc-file: condarc.yml
1932
auto-update-conda: false
20-
conda-solver: libmamba
2133
auto-activate-base: true
2234
activate-environment: ""
35+
2336
- name: Install Build Tools
24-
run: conda install python anaconda-client conda-build
37+
run: mamba install python anaconda-client conda-build conda-verify
38+
2539
- name: Configure Auto-Upload
2640
if: github.ref == 'refs/heads/stable'
2741
run: |
2842
conda config --set anaconda_upload yes
43+
2944
- name: Build Binary
3045
run: |
31-
# set a default value to the conda_token if needed (like from forks)
32-
: "${CONDA_TOKEN:=${{ secrets.ANACONDA_TOKEN }}}"
33-
: "${CONDA_TOKEN:=default_value}"
46+
# Set the CONDA_TOKEN environment variable
47+
if [ -z "${{ secrets.ANACONDA_TOKEN }}" ]; then
48+
export CONDA_TOKEN="default_value"
49+
else
50+
export CONDA_TOKEN="${{ secrets.ANACONDA_TOKEN }}"
51+
fi
52+
3453
echo "CONDA_TOKEN=$CONDA_TOKEN" >> $GITHUB_ENV
35-
conda config --add channels conda-forge
36-
conda-build --token "$CONDA_TOKEN" --user rmg .conda
54+
55+
# Conditionally add the --token and --user flags for stable branches
56+
if [[ "${GITHUB_REF}" == "refs/heads/stable" ]]; then
57+
conda-build --token "$CONDA_TOKEN" --user rmg .conda
58+
else
59+
conda-build .conda
60+
fi

0 commit comments

Comments
 (0)