Update meta.yaml #71
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 and PyPI Publish with License Update | |
on: | |
push: | |
branches: | |
- main # Trigger on push to main | |
jobs: | |
update-license-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Automatically bump version in setup.py | |
run: | | |
VERSION=$(python setup.py --version) | |
echo "Current version is $VERSION" | |
# Increment the minor version (adjust as needed) | |
NEW_VERSION=$(echo $VERSION | awk -F. -v OFS=. '{$NF++;print}') | |
echo "New version is $NEW_VERSION" | |
sed -i "s/version=\"$VERSION\"/version=\"$NEW_VERSION\"/" setup.py | |
- name: Install PyPI dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine build | |
- name: Install Miniconda | |
run: | | |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh | |
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda3 | |
echo "Miniconda installed at $HOME/miniconda3" | |
- name: Set up Conda PATH | |
run: | | |
export PATH="$HOME/miniconda3/bin:$PATH" | |
echo "PATH: $PATH" | |
$HOME/miniconda3/bin/conda info | |
- name: Configure Conda for Packaging | |
run: | | |
export PATH="$HOME/miniconda3/bin:$PATH" | |
$HOME/miniconda3/bin/conda config --add channels conda-forge | |
$HOME/miniconda3/bin/conda install -y conda-build anaconda-client | |
$HOME/miniconda3/bin/conda list conda-build | |
- name: Build PyPI Package | |
run: | | |
python -m build | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
python -m twine upload dist/* | |
- name: Build Conda Package | |
run: | | |
export PATH="$HOME/miniconda3/bin:$PATH" | |
$HOME/miniconda3/bin/conda build . | |
- name: Upload Conda Package to Anaconda | |
env: | |
ANACONDA_API_KEY: ${{ secrets.ANACONDA_API_KEY }} | |
run: | | |
export PATH="$HOME/miniconda3/bin:$PATH" | |
PACKAGE_PATH=$($HOME/miniconda3/bin/find $HOME/miniconda3/conda-bld/linux-64 -name '*fezrs*.tar.bz2' | head -n 1) | |
if [ -z "$PACKAGE_PATH" ]; then | |
echo "No Conda package found to upload!" | |
exit 1 | |
fi | |
echo "Uploading package: $PACKAGE_PATH" | |
$HOME/miniconda3/bin/anaconda upload $PACKAGE_PATH --token $ANACONDA_API_KEY |