<commit_before>name: Upload Python Package to PYPI

on:
  release:
    types: [created]

jobs:
  deploy:

    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Set env
      run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

    - name: Setup Miniconda
      uses: conda-incubator/setup-miniconda@v2
      with:
        python-version: 3.9
        mamba-version: "*"
        channels: conda-forge
        channel-priority: strict
        auto-update-conda: true
        miniconda-version: "latest"
        activate-environment: pypi

    - name: Set up Conda environment
      shell: bash -l {0}
      run: |
        mamba config --set always_yes yes --set changeps1 no
        mamba install -q -n pypi fftw \
                                 liblapack \
                                 openblas \
                                 numpy \
                                 setuptools \
                                 pypandoc \
                                 versioneer \
                                 twine
        mamba list -n pypi

    - name: Build and publish
      env:
        # PYPI repository
        TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
        TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
        # PYPITEST repository
        # TWINE_USERNAME: ${{ secrets.PYPITEST_USERNAME }}
        # TWINE_PASSWORD: ${{ secrets.PYPITEST_PASSWORD }}
        # TWINE_REPOSITORY_URL: 'https://test.pypi.org/legacy/'
      shell: bash -l {0}
      run: |
        mamba env list
        python setup.py sdist
        twine upload dist/*

    - name: Trigger a build on the SHTOOLS/build-shtools repo
      run: |
        curl -X POST \
        https://api.github.com/repos/SHTOOLS/build-shtools/dispatches \
        -H 'Accept: application/vnd.github.everest-preview+json' \
        -u ${{ secrets.ACCESS_TOKEN }} \
        --data '{"event_type": "New pyshtools release", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'

    - name: Download tarball archive
      uses: carlosperate/download-file-action@v1.0.3
      id: download-tarball
      with:
        file-url: 'https://github.com/SHTOOLS/SHTOOLS/archive/${{ env.RELEASE_VERSION }}.tar.gz'

    - name: Upload tarball as release asset
      uses: alexellis/upload-assets@0.2.2<commit_msg>Update version numbers of packages used in workflow<commit_after>name: Upload Python Package to PYPI

on:
  release:
    types: [created]

jobs:
  deploy:

    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Set env
      run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

    - name: Setup Miniconda
      uses: conda-incubator/setup-miniconda@v2
      with:
        python-version: 3.9
        mamba-version: "*"
        channels: conda-forge
        channel-priority: strict
        auto-update-conda: true
        miniconda-version: "latest"
        activate-environment: pypi

    - name: Set up Conda environment
      shell: bash -l {0}
      run: |
        mamba config --set always_yes yes --set changeps1 no
        mamba install -q -n pypi fftw \
                                 liblapack \
                                 openblas \
                                 numpy \
                                 setuptools \
                                 pypandoc \
                                 versioneer \
                                 twine
        mamba list -n pypi

    - name: Build and publish
      env:
        # PYPI repository
        TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
        TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
        # PYPITEST repository
        # TWINE_USERNAME: ${{ secrets.PYPITEST_USERNAME }}
        # TWINE_PASSWORD: ${{ secrets.PYPITEST_PASSWORD }}
        # TWINE_REPOSITORY_URL: 'https://test.pypi.org/legacy/'
      shell: bash -l {0}
      run: |
        mamba env list
        python setup.py sdist
        twine upload dist/*

    - name: Trigger a build on the SHTOOLS/build-shtools repo
      run: |
        curl -X POST \
        https://api.github.com/repos/SHTOOLS/build-shtools/dispatches \
        -H 'Accept: application/vnd.github.everest-preview+json' \
        -u ${{ secrets.ACCESS_TOKEN }} \
        --data '{"event_type": "New pyshtools release", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'

    - name: Download tarball archive
      uses: carlosperate/download-file-action@v1.1.1
      id: download-tarball
      with:
        file-url: 'https://github.com/SHTOOLS/SHTOOLS/archive/${{ env.RELEASE_VERSION }}.tar.gz'

    - name: Upload tarball as release asset
      uses: alexellis/upload-assets@0.3.0
{'fraction_non_alphanumeric': 0.10445859872611465, 'fraction_numerical': 0.005520169851380042, 'mean_word_length': 1.6615819209039548, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5375671', 'n_tokens_mistral': 1529, 'n_tokens_neox': 1457, 'n_words': 326}