@@ -3,14 +3,48 @@ name: Build and publish to Conda
33on :
44 release :
55 types : [published]
6+ workflow_dispatch :
7+ inputs :
8+ test_version :
9+ description : ' Test version (e.g., 1.0.0.test1)'
10+ required : true
11+ default : ' 1.0.0.test1'
12+ test_channel :
13+ description : ' Anaconda channel label (leave empty for main)'
14+ required : false
15+ default : ' test'
616
717jobs :
818 publish :
919 runs-on : ubuntu-latest
1020 steps :
11- - uses : actions/checkout@v1
12- - name : publish-to-conda
13- uses : stefanoamorelli/conda-package-publish-action@v3-hotfix
21+ - uses : actions/checkout@v4
22+ - uses : conda-incubator/setup-miniconda@v3
1423 with :
15- subDir : " conda"
16- anacondaToken : ${{ secrets.ANACONDA_TOKEN }}
24+ miniconda-version : " latest"
25+ channels : conda-forge,defaults
26+ channel-priority : strict
27+ - shell : bash -l {0}
28+ run : |
29+ conda install conda-build anaconda-client -c conda-forge
30+
31+ # Set version - from release tag or workflow input
32+ if [ "${{ github.event_name }}" = "release" ]; then
33+ export GIT_DESCRIBE_TAG=${GITHUB_REF#refs/tags/v}
34+ CHANNEL_LABEL=""
35+ else
36+ # Convert test version format for conda (no hyphens allowed)
37+ TEST_VERSION="${{ github.event.inputs.test_version }}"
38+ export GIT_DESCRIBE_TAG=$(echo "$TEST_VERSION" | sed 's/-/./')
39+ CHANNEL_LABEL="${{ github.event.inputs.test_channel }}"
40+ fi
41+
42+ echo "Building version: $GIT_DESCRIBE_TAG"
43+ conda build conda/ --no-anaconda-upload
44+
45+ # Upload with appropriate channel label
46+ if [ -z "$CHANNEL_LABEL" ]; then
47+ anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload $(conda build conda/ --output) --force
48+ else
49+ anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload $(conda build conda/ --output) --force --label $CHANNEL_LABEL
50+ fi
0 commit comments