Conda build #205
This file contains 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: Conda build | |
on: | |
schedule: | |
- cron: '21 21 * * 5' | |
push: | |
branches: [ master ] | |
# Publish semver tags as releases. | |
tags: [ 'v*.*.*' ] | |
release: | |
types: [published] | |
jobs: | |
conda-build-arm64: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'schedule' || github.event_name == 'release' }} | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Setup for Multi-platform image | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and publish conda package arm64 | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: scripts/Dockerfile_conda_build | |
platforms: linux/arm64 | |
build-args: | | |
PYTHON_VERSION=${{ matrix.python-version }} | |
ANACONDA_API_TOKEN=${{ secrets.CONDA_TOKEN }} | |
conda-build-amd64: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Setup for Multi-platform image | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and publish conda package amd64 | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: scripts/Dockerfile_conda_build | |
platforms: linux/amd64 | |
build-args: | | |
PYTHON_VERSION=${{ matrix.python-version }} | |
ANACONDA_API_TOKEN=${{ secrets.CONDA_TOKEN }} | |
conda-build-osx: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
os: ["macos-14", "macos-13"] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
auto-update-conda: true | |
channels: conda-forge,defaults | |
activate-environment: anaconda-client-env | |
- shell: bash -el {0} | |
run: | | |
export PYTHON_VERSION=${{ matrix.python-version }} | |
conda install -y conda-build anaconda-client | |
conda config --set anaconda_upload no | |
export ANACONDA_API_TOKEN=${{ secrets.CONDA_TOKEN }} | |
PACKAGE_PATH=$(conda build . --python ${{ matrix.python-version }} --output) | |
conda build . --python ${{ matrix.python-version }} | |
if [ "${{ matrix.python-version }}" == "3.11" ]; then | |
anaconda -t $ANACONDA_API_TOKEN upload $PACKAGE_PATH --label main --label py3.11 --force | |
else | |
anaconda -t $ANACONDA_API_TOKEN upload $PACKAGE_PATH --label py${{ matrix.python-version }} --force | |
fi | |