Skip to content

workflow fix and readme edit #96

workflow fix and readme edit

workflow fix and readme edit #96

Workflow file for this run

name: Conda Release to Anaconda.org
on:
push:
tags:
- 'v*.*.*'
jobs:
build-and-upload:
strategy:
matrix:
platform:
- subdir: linux-64
runs: ubuntu-latest
arch: x86_64
- subdir: linux-aarch64
runs: ubuntu-24.04-arm
arch: aarch64
- subdir: osx-64
runs: macos-13
arch: x86_64
- subdir: osx-arm64
runs: macos-latest
arch: arm64
runs-on: ${{ matrix.platform.runs }}
defaults:
run:
shell: bash -l {0}
steps:
# 1) Check out the current repo (so we can access conda-recipe/)
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
# 2) Install Miniconda & configure channels
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge, defaults
use-only-tar-bz2: true
auto-update-conda: true
auto-activate-base: true
architecture: ${{ matrix.platform.arch }}
# 2) Install conda-build and anaconda-client
- name: create environment with conda
run: |
conda install -y conda-build anaconda-client
# 3) Compute VERSION, TAR_URL, SHA256, and REPO info
- name: Set version and SHA256
id: vars
run: |
# Strip leading "v" from tag name (e.g. "v0.3.0" -> "0.3.0")
VERSION=${GITHUB_REF_NAME#v}
# Build the GitHub tarball URL
TAR_URL="https://github.com/${GITHUB_REPOSITORY}/archive/refs/tags/v${VERSION}.tar.gz"
# Download tarball and compute SHA256 checksum
curl -L $TAR_URL -o release.tar.gz
if command -v sha256sum &>/dev/null; then
# linux
SHA256=$(sha256sum release.tar.gz | cut -d' ' -f1)
else
# mac
SHA256=$(shasum -a 256 release.tar.gz | awk '{ print $1 }')
fi
# Extract OWNER and REPO from GITHUB_REPOSITORY (format: owner/repo)
REPO_OWNER=${GITHUB_REPOSITORY%%/*}
REPO_NAME=${GITHUB_REPOSITORY##*/}
# Build repo home URL
REPO_HOME="https://github.com/${GITHUB_REPOSITORY}"
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "TAR_URL=$TAR_URL" >> $GITHUB_OUTPUT
echo "SHA256=$SHA256" >> $GITHUB_OUTPUT
echo "REPO_OWNER=$REPO_OWNER" >> $GITHUB_OUTPUT
echo "REPO_HOME=$REPO_HOME" >> $GITHUB_OUTPUT
# 4) Build the conda package for each platform
- name: Build conda package
env:
VERSION: ${{ steps.vars.outputs.VERSION }}
TAR_URL: ${{ steps.vars.outputs.TAR_URL }}
SHA256: ${{ steps.vars.outputs.SHA256 }}
REPO_OWNER: ${{ steps.vars.outputs.REPO_OWNER }}
REPO_NAME: ${{ steps.vars.outputs.REPO_NAME }}
REPO_HOME: ${{ steps.vars.outputs.REPO_HOME }}
run: |
cd conda-recipe
conda-build . --output-folder ../conda-build-artifacts
# 5) Upload the built artifacts to Anaconda.org
- name: Upload to Anaconda.org
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
ANACONDA_USER: ${{ secrets.ANACONDA_USER }}
VERSION: ${{ steps.vars.outputs.VERSION }}
run: |
for PKG in conda-build-artifacts/${{ matrix.platform.subdir }}/*-${{ env.VERSION }}-*.tar.bz2; do
echo "Uploading $PKG"
anaconda -t $ANACONDA_TOKEN upload "$PKG" --user $ANACONDA_USER --label main --force
done