Fixed pypi publishing #12
Workflow file for this run
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: Deploy Main | |
on: | |
release: | |
types: [published] | |
jobs: | |
deploy-pypi: | |
runs-on: ubuntu-latest | |
environment: deployment | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Install Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
- name: Install Twine | |
run: sudo pip install twine | |
- name: Create the distribution | |
run: | | |
git fetch --prune --unshallow --tags | |
sudo python setup.py sdist bdist_wheel | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
deploy-conda: | |
runs-on: ubuntu-latest | |
# sets default shell to remove need for source to run the conda shell | |
defaults: | |
run: | |
shell: bash -l {0} | |
environment: deployment | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Install Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
# Much better than manual installation, original version Miniconda2-4.7.10-Linux-x86_64.sh is broken | |
- name: Install Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-activate-base: true | |
activate-environment: "" | |
miniconda-version: "latest" | |
- name: Install the Mamba Dependencies | |
run: | | |
conda config --set always_yes yes --set auto_update_conda false | |
conda update conda | |
conda install mamba -n base -c conda-forge | |
conda install -n base conda-libmamba-solver | |
mamba install python=3.10 "conda-build=3.21.9" colorama pip ruamel ruamel.yaml rich mamba jsonschema -c conda-forge | |
pip install -e . | |
# echo yes before login to prevent anaconda bug breaking automation | |
# git tags MUST be fetched otherwise output will be blank | |
# bash variables cannot be used in github actions, must use actions specific syntax and methods | |
# channels need to be specified on build and are saved in the package for installs | |
- name: Build the Anaconda Package | |
id: mambabuild | |
run: | | |
mamba install anaconda-client | |
conda config --set anaconda_upload no --set solver libmamba | |
echo yes | anaconda login --username ${{ secrets.ANACONDA_CLOUD_USERNAME }} --password ${{ secrets.ANACONDA_CLOUD_PASSWORD }} | |
git fetch --prune --unshallow --tags | |
VERSION_FROM_GIT_TAG=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-) conda build . -c mosek -c anaconda -c pvlib -c slacgismo -c conda-forge --numpy 1.22.0 | |
echo '::set-output name=gitversion::$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-)' | |
- name: Upload the Anaconda Package | |
id: condaload | |
run: | | |
anaconda upload -u slacgismo /usr/share/miniconda3/conda-bld/noarch/solar-data-tools-${{ steps.mambabuild.outputs.gitversion }}-*.tar.bz2 |