A collection of Github Actions to build your software package and publish to an Anaconda repository.
These actions have been developed for the needs of OpenAlea
project. It is mostly inspired by existing projects such as build-and-upload-conda-packages or Publish Conda package to Anaconda.org and uses Setup Miniconda.
The main openalea workflow using these actions can be found here
The different actions are :
This action:
- Check if
meta.yml
exists in a directory provided in input - Sets-up a basic conda environment with a python version specified in input (python 3 only). You can also specify a list of conda channels you migh need during the building process
- Installs necessary packages for building and publishing (namely
conda-build
andanaconda-client
) - Compiles the package with
conda build
using themeta.yml
file rules. If your package uses thenumpy
library as a dependency, please be aware that library versions are tied to python version at build time if expressed explicitely in themeta.yml
file (so far, existing options arepython3.7
:numpy1.11
,python3.8
:numpy1.16
,python3.9
:numpy1.19
). Otherwise,numpy
minor version used at build time can be expressed explicitely in input (cf. bellow). - Uploads the package on anaconda.org with
anaconda upload
using a token to access your repository or the one of your organization (cf. procedure here)
The only mandatory input is the anaconda token to access your anaconda repository.
This action is designed to be very generic and the workflow will work even for non pure-python packages.
# your_github_workflow.yml
name: MyWorkflow
...
steps:
...
- name: Build and Publish
uses: openalea/action-build-publish-anaconda/build_and_publish@main
with:
token: ${{ secrets.ANACONDA_TOKEN }}
numpy: '22'
channels: 'openalea3,conda-forge'
label: 'main'
The following inputs are available for this action:
Name | Description | Required | Default value |
---|---|---|---|
conda |
Directory with conda recipe (i.e. meta.yml file) |
No | conda |
python |
Python3 minor version targeted for build | No | 12 |
numpy |
Numpy minor version used for building | No | '' (fixed by python version) |
token |
Anaconda access Token (cf. use process described above) | Yes | |
channels |
Optional Extra anaconda channels to use. Coma-separated syntax | No | conda-forge |
publish |
Wether we publish the package build on anaconda cloud or not | No | 'true' |
label |
Label of conda package published | No | latest |
build-options |
Extra options for conda build | No | `` |
.
├── LICENSE
├── README.md
├── myproject
│ ├── __init__.py
│ └── myproject.py
├── conda
| ├── bld.bat
│ ├── build.sh
│ └── meta.yaml
├── .github
│ └── workflows
│ └── build_publish_anaconda.yml
├── .gitignore
This token's purpose is to let your github project access your anaconda repository to publish your package on your channel once it has been successfully built.
- Get an Anaconda token (don't forget to specify the read and write API access) at
anaconda.org/USERNAME/settings/access
and copy it. - Let the github repository of your project access to this token: Add it to the Secrets (
Settings
->Secrets
->Actions
->New repository secret
) of the Github repository asANACONDA_TOKEN