Merge pull request #863 from neuropsychology/dev #23
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: 📦 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@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- 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@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- 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 }} |