Skip to content

rename project to sqtop #7

rename project to sqtop

rename project to sqtop #7

name: publish-packages
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
publish-crates:
name: publish-crates-io
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Skip publish when token is missing
if: env.CARGO_REGISTRY_TOKEN == ''
run: |
echo "CARGO_REGISTRY_TOKEN is not configured; skipping crates.io publish."
- name: Publish crate
if: env.CARGO_REGISTRY_TOKEN != ''
run: cargo publish --locked
build-conda:
name: build-conda-linux-64
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
ANACONDA_OWNER: ${{ vars.ANACONDA_OWNER }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set package version
run: echo "ST_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
miniforge-version: latest
channels: conda-forge
channel-priority: strict
activate-environment: conda-build
auto-activate-base: false
use-mamba: true
- name: Install conda-build tooling
shell: bash -el {0}
run: |
mamba install -y conda-build anaconda-client
- name: Build conda package
shell: bash -el {0}
run: |
conda build recipe --output-folder conda-dist
- name: Record conda artifact path
shell: bash -el {0}
run: |
PACKAGE_PATH="$(find conda-dist -type f \( -name '*.conda' -o -name '*.tar.bz2' \) | head -n 1)"
if [[ -z "${PACKAGE_PATH}" ]]; then
echo "No conda package was produced" >&2
exit 1
fi
echo "PACKAGE_PATH=${PACKAGE_PATH}" >> "$GITHUB_ENV"
- name: Upload conda artifact
uses: actions/upload-artifact@v4
with:
name: conda-linux-64
path: ${{ env.PACKAGE_PATH }}
- name: Resolve Anaconda owner
shell: bash -el {0}
run: |
OWNER="${ANACONDA_OWNER}"
if [[ -z "${OWNER}" ]]; then
OWNER="${GITHUB_REPOSITORY_OWNER}"
fi
echo "ANACONDA_UPLOAD_OWNER=${OWNER}" >> "$GITHUB_ENV"
- name: Skip upload when token is missing
if: env.ANACONDA_API_TOKEN == ''
shell: bash -el {0}
run: |
echo "ANACONDA_API_TOKEN is not configured; skipping Anaconda.org upload."
- name: Upload to Anaconda.org
if: env.ANACONDA_API_TOKEN != ''
shell: bash -el {0}
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
run: |
anaconda -t "${ANACONDA_API_TOKEN}" upload \
--user "${ANACONDA_UPLOAD_OWNER}" \
--label main \
"${PACKAGE_PATH}"