88 required : true
99 type : string
1010 python-version :
11- description : ' Python version to use (eg: 3.10)'
11+ description : ' Python version to use (e.g. 3.10)'
1212 required : true
1313 type : string
1414 lfs :
1515 description : ' Boolean to indicate if Github LFS is needed'
1616 required : false
1717 type : boolean
1818 default : true
19+ conda-channels :
20+ description : ' List of conda channels to pull from (e.g. ["conda-forge", "pytorch"])'
21+ required : true
22+ type : string
1923 source-repo-names :
20- description : ' Matrix of repository names to publish on (eg. ["public -conda-dev-local ", "conda-forge- dev-remote "])'
24+ description : ' List of repository names to pull from (e.g. ["geology -conda-dev", "geophysics- conda-dev"])'
2125 required : true
2226 type : string
2327 publish-repo-names :
24- description : ' Matrix of virtual repository names to publish on (eg . ["public-conda-dev"])'
28+ description : ' List of repository names to publish on (e.g . ["public-conda-dev"])'
2529 required : true
2630 type : string
2731 os :
28- description : ' OS to build against (eg . "ubuntu-latest")'
32+ description : ' OS to build against (e.g . "ubuntu-latest")'
2933 required : false
3034 type : string
3135 default : ' ubuntu-latest'
@@ -47,6 +51,11 @@ defaults:
4751 run :
4852 shell : ' bash -l {0}'
4953
54+ env :
55+ # cover for both conda and mamba
56+ CONDA_CHANNEL_ALIAS : https://repo.prefix.dev
57+ MAMBA_CHANNEL_ALIAS : https://repo.prefix.dev
58+
5059jobs :
5160 build_rattler_package :
5261 name : Build package with rattler
@@ -67,31 +76,29 @@ jobs:
6776 echo "Rattler recipe not found"
6877 exit 1
6978 fi
70- - name : Auths with JFrog channels
79+ - name : Configure channels and Auth
80+ id : config-channels
7181 run : |
72- BUILDS_ARGS =""
82+ BUILD_ARGS =""
7383 RATTLER_AUTH_FILE=${{ runner.temp }}/credentials.json
7484
75- repository_list=$(echo '${{ inputs.source-repo-names }}' | jq -r '.[]')
76- repository_count=$(echo '${{ inputs.source-repo-names }}' | jq '. | length')
77-
78- # Check if there is more than one element
79- if [ "$repository_count" -ge 1 ]; then
85+ repository_list=$(echo '${{ inputs.source-repo-names }}' | jq -r '.[]' | xargs)
86+ if [ -n "$repository_list" ]; then
8087 echo '{"${{ secrets.JFROG_ARTIFACTORY_URL }}": {"BasicHTTP": {"username": "github", "password":"${{ secrets.JFROG_ARTIFACTORY_TOKEN }}"} } }' > "$RATTLER_AUTH_FILE"
81- else
82- BUILDS_ARGS=" --channel conda-forge"
8388 fi
89+ echo "RATTLER_AUTH_FILE=${RATTLER_AUTH_FILE}" >> "$GITHUB_ENV"
8490
8591 # Loop through the repository names and add them to the command
8692 for repo_name in ${repository_list}; do
87- BUILDS_ARGS +=" --channel https://${{ secrets.JFROG_ARTIFACTORY_URL }}/artifactory/api/conda/${repo_name}"
93+ BUILD_ARGS +=" --channel https://${{ secrets.JFROG_ARTIFACTORY_URL }}/artifactory/api/conda/${repo_name}"
8894 done
8995
90- BUILDS_ARGS+=" --output-dir ${{ runner.temp }}/output"
91- BUILDS_ARGS+=" --channel-priority disabled"
96+ channel_list=$(echo '${{ inputs.conda-channels }}' | jq -r '.[]' | xargs)
97+ for channel_name in ${channel_list}; do
98+ BUILD_ARGS+=" --channel ${channel_name}"
99+ done
92100
93- echo "RATTLER_AUTH_FILE=${RATTLER_AUTH_FILE}" >> "$GITHUB_ENV"
94- echo "BUILDS_ARGS=$BUILDS_ARGS" >> "$GITHUB_ENV"
101+ echo "BUILD_ARGS=$BUILD_ARGS" >> "$GITHUB_OUTPUT"
95102 - name : Check RATTLER_AUTH_FILE content
96103 run : |
97104 echo "RATTLER_AUTH_FILE=${{ env.RATTLER_AUTH_FILE }}"
@@ -104,7 +111,10 @@ jobs:
104111 uses : prefix-dev/rattler-build-action@v0.2.32
105112 with :
106113 rattler-build-version : v0.34.1
107- build-args : ${{ env.BUILDS_ARGS }}
114+ build-args : >-
115+ --output-dir ${{ runner.temp }}/output
116+ --channel-priority strict
117+ ${{ steps.config-channels.outputs.BUILD_ARGS }}
108118 recipe-path : ${{ github.workspace}}/recipe.yaml
109119 env :
110120 RATTLER_AUTH_FILE : ${{ runner.temp }}/credentials.json
@@ -123,7 +133,7 @@ jobs:
123133 needs : build_rattler_package
124134 strategy :
125135 matrix :
126- virtual -repo-name : ${{ fromJson(inputs.publish-repo-names) }}
136+ publish -repo-name : ${{ fromJson(inputs.publish-repo-names) }}
127137 steps :
128138 - name : Download build artifact
129139 uses : actions/download-artifact@v4
@@ -134,7 +144,7 @@ jobs:
134144 uses : MiraGeoscience/CI-tools/.github/actions/reusable-python-publish_to_artifactory@main
135145 with :
136146 build-dir-path : ' build-dir/noarch'
137- artifactory-dir-path : ${{ matrix.virtual -repo-name}}/noarch
147+ artifactory-dir-path : ${{ matrix.publish -repo-name}}/noarch
138148 JFROG_ARTIFACTORY_URL : ${{ secrets.JFROG_ARTIFACTORY_URL }}
139149 JFROG_ARTIFACTORY_TOKEN : ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
140150 add_release_asset :
0 commit comments