neuropsychology/NeuroKit

View on GitHub
.github/workflows/releasePR.yml

Summary

Maintainability
Test Coverage
name: 📦 Release PR
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
on:
  push:
    branches:
      - master

jobs:
  readme:
    name: Run README and save figures
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: '3.7'
 
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install https://github.com/DominiqueMakowski/popularipy/zipball/master
        cd $GITHUB_WORKSPACE && pip install .[test]
   
    - name: Run README_examples.py
      run: |
        cd $GITHUB_WORKSPACE/docs/readme
        python README_examples.py
        
    - name: Commit figures
      uses: EndBug/add-and-commit@v4
      with:
        message: "Update README figures"
        ref: 'master'
        add: "*.png"
        
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 
 
  build-n-publish:
    name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
    needs: readme
    if: always()
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@master
    
    - name: Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: '3.x'
        
    - name: Install pep517
      run: >-
        python -m
        pip install
        pep517
        --user
        
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install setuptools wheel twine
        
    - name: Build package
      run: python setup.py sdist bdist_wheel
      
    - name: Publish distribution 📦 to Test PyPI
      uses: pypa/gh-action-pypi-publish@master
      with:
        password: ${{ secrets.TEST_PYPI_PASSWORD }}
        repository_url: https://test.pypi.org/legacy/
    
    - name: Publish distribution 📦 to PyPI
      #if: startsWith(github.event.ref, 'refs/tags')
      uses: pypa/gh-action-pypi-publish@master
      with:
        password: ${{ secrets.PYPI_PASSWORD }}