Skip to content

Bump version to 0.2.0 and add Conda‐release workflow #1

Bump version to 0.2.0 and add Conda‐release workflow

Bump version to 0.2.0 and add Conda‐release workflow #1

Workflow file for this run

name: Conda Release to Anaconda.org
on:
push:
tags:
- 'v*.*.*'
jobs:
build-and-upload:
runs-on: ubuntu-latest
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 and conda-build/anaconda-client
- name: Install Miniconda and tools
run: |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
eval "$($HOME/miniconda/bin/conda shell.bash hook)"
conda install -y conda-build anaconda-client
# 3) Determine VERSION (strip the leading “v”) and compute SHA256
- name: Set version and SHA256
id: vars
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
# Download tarball for this tag and compute checksum
TAR_URL="https://github.com/${GITHUB_REPOSITORY}/archive/refs/tags/v${VERSION}.tar.gz"
curl -L $TAR_URL -o release.tar.gz
SHA256=$(sha256sum release.tar.gz | cut -d' ' -f1)
echo "SHA256=$SHA256" >> $GITHUB_OUTPUT
# 4) Update meta.yaml with the correct version and sha256
- name: Patch conda-recipe/meta.yaml
run: |
cd conda-recipe
sed -i "s/^ version: .*/ version: ${{ steps.vars.outputs.VERSION }}/" meta.yaml
sed -i "s/^ sha256: .*/ sha256: ${{ steps.vars.outputs.SHA256 }}/" meta.yaml
# 5) Build the conda package
- name: Build conda package
run: |
eval "$($HOME/miniconda/bin/conda shell.bash hook)"
cd conda-recipe
conda-build . --output-folder ../conda-build-artifacts
# 6) Upload the built package to Anaconda.org
- name: Upload to Anaconda.org
env:
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
eval "$($HOME/miniconda/bin/conda shell.bash hook)"
PACKAGE=$(ls conda-build-artifacts/linux-64/aligncount-demo-${{ steps.vars.outputs.VERSION }}-*.tar.bz2)
anaconda -t $ANACONDA_TOKEN upload $PACKAGE --user $ANACONDA_USER --label main --force