Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .conda/recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% set version = environ["PKG_VERSION"] %}

package:
name: csdl_alpha
version: {{ version }}

source:
path: ../..

build:
number: 0
noarch: python
script: "{{ PYTHON }} -m pip install . --no-deps --no-build-isolation -vv"

requirements:
host:
- python >=3.9
- pip
- setuptools
run:
- python >=3.9
- numpy
- scipy
- sympy
- rustworkx
- networkx
- h5py
- pydot
- pytest

about:
home: https://github.com/LSDOlab/CSDL_alpha
license: LGPL-3.0-or-later
license_file: LICENSE
summary: Computational System Design Language.

extra:
recipe-maintainers:
- LSDOlab
59 changes: 59 additions & 0 deletions .github/workflows/conda-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish Conda package

on:
push:
tags: ["v*"]
workflow_dispatch:

permissions:
contents: read

jobs:
publish:
runs-on: ubuntu-latest
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
ANACONDA_OWNER: LSDOlab
steps:
- uses: actions/checkout@v4

- name: Set up Conda build tools
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: conda-build
python-version: "3.12"
channels: conda-forge
channel-priority: strict
auto-update-conda: false

- name: Install publishing tools
shell: bash -el {0}
run: conda install --yes --channel conda-forge conda-build anaconda-client

- name: Read normalized package version
id: package
shell: bash
run: |
python - <<'PY' >> "$GITHUB_OUTPUT"
from pathlib import Path
from packaging.version import Version
import re
text = Path("csdl_alpha/__init__.py").read_text()
match = re.search(r"^__version__\s*=\s*['\"]([^'\"]+)", text, re.M)
assert match, "version not found"
print(f"version={Version(match.group(1))}")
PY

- name: Build Conda package
shell: bash -el {0}
env:
PKG_VERSION: ${{ steps.package.outputs.version }}
run: conda build .conda/recipe --channel conda-forge --output-folder "$RUNNER_TEMP/conda-bld"

- name: Publish to Anaconda.org
shell: bash -el {0}
run: |
test -n "$ANACONDA_API_TOKEN" || { echo "::error::ANACONDA_API_TOKEN is not configured"; exit 1; }
package_file="$(find "$RUNNER_TEMP/conda-bld/noarch" -maxdepth 1 -type f \( -name '*.conda' -o -name '*.tar.bz2' \) -print -quit)"
test -n "$package_file" || { echo "::error::Conda build did not produce a noarch package"; exit 1; }
anaconda --token "$ANACONDA_API_TOKEN" upload --user "$ANACONDA_OWNER" --label main "$package_file"
Loading